Bug #969
closedEOFError when doing net/http post with large body
Description
=begin
Official Ruby 1.8.7-i386-mswin32 binary.
Running Windows Vista SP1 64-bit.
When performing an HTTP post using net/http, and a body under 23,400 bytes, I get a response from the server. When over 23,500 bytes, I get the following error:
C:\Users\tim\Desktop\ruby\bin>ruby ../../cr.rb
C:/Users/tim/Desktop/ruby/lib/ruby/1.8/uri.rb:16: warning: already initialized constant VERSION_CODE
C:/Users/tim/Desktop/ruby/lib/ruby/1.8/uri.rb:17: warning: already initialized constant VERSION
C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/protocol.rb:135:in sysread': end of file reached (EOFError) from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/protocol.rb:135:in
rbuf_fill'
from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/timeout.rb:62:in timeout' from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/timeout.rb:93:in
timeout'
from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/protocol.rb:134:in rbuf_fill' from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/protocol.rb:116:in
read until'
from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/protocol.rb:126:in readline' from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/http.rb:2020:in
read_status_line'
from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/http.rb:2009:in read_new' from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/http.rb:1050:in
request'
from ../../cr.rb:11
from C:/Users/tim/Desktop/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
from ../../cr.rb:11
The above error message is triggered with the following script:
require 'URI'
require 'net/http'
body_string = 'a' * 23500
url = 'http://google.com'
uri = URI.parse url
http = Net::HTTP.new uri.host, uri.port
req = Net::HTTP::Post.new uri.request_uri
req.body = body_string
response = http.start{|conn| conn.request req}
puts response.body
=end
Files