Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: JRuby 0.9.0
-
Fix Version/s: None
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:OS X, latest JRuby, but observed it on Ubuntu too
-
Number of attachments :
Description
If you do a POST using Net::HTTP and the data you're posting doesn't end with \n, it doesn't flush and the server eventually times out. Fixed witih an IO#flush in net/protocol.rb like so:
diff protocol.rb /usr/local/lib/ruby/1.8/net/protocol.rb
14c14
< # $Id: protocol.rb,v 1.2 2006/06/10 19:14:11 headius Exp $
—
> # $Id: protocol.rb,v 1.73.2.3 2005/09/13 07:27:18 aamine Exp $
153d152
< @io.flush
Adding @io.flush would wallpaper the actual problem (it should be flushing without this). Are you sure this is latest trunk? Or is it 0.9.0?
JRUBY-52had a similiar problem this month and it has been fixed since then. At least it fixes the following test:Server:
require 'socket'
serv = TCPServer.new('localhost',2202)
sock = serv.accept
puts sock.read(5)
sock.write "world!"
sock.close
Client:
require 'socket'
socket = TCPSocket.new("localhost",2202)
socket.write "Hello"
puts socket.read(6)
socket.close
A HTTP POST creates a TCPSocket and then wraps it with protocol.rb's BufferedIO. I would think with the following code above working we should be golden per your description of the problem. If you are using trunk, then could you run the client and server above and make sure this test is working?
JRUBY-52had a similiar problem this month and it has been fixed since then. At least it fixes the following test: Server: require 'socket' serv = TCPServer.new('localhost',2202) sock = serv.accept puts sock.read(5) sock.write "world!" sock.close Client: require 'socket' socket = TCPSocket.new("localhost",2202) socket.write "Hello" puts socket.read(6) socket.close A HTTP POST creates a TCPSocket and then wraps it with protocol.rb's BufferedIO. I would think with the following code above working we should be golden per your description of the problem. If you are using trunk, then could you run the client and server above and make sure this test is working?