Hello all,

The following change to Mongrel::HttpRequest:

def read_socket(len)
  if [EMAIL PROTECTED]
    data = @socket.recv(len) # <--- formerly @socket.read(len)
    if !data
      raise "Socket read return nil"
    elsif data.length != len
      raise "Socket read returned insufficient data: #{data.length}"
    else
      data
    end
  else
    raise "Socket already closed when reading."
  end
end

seems to work for me, and vastly improves the speed of the body
processing (quick tests reveal that using IO#read takes about 1 min 40
secs. and using Socket#recv takes about 9 secs on an 8.5 mb file). I
have been having trouble discovering the difference between read &
recv (I am not a socket developer by any means). Can anybody tell me
what sort of safety one loses by doing this with recv instead of read?
Thanks.

best,
Erik Hetzner

Attachment: pgpT9YCLDTmZG.pgp
Description: PGP signature

_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to