1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/net/http/test_post_io.rb: parse chunked stream to avoid client

side connection error raised.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nahi 2009-12-22 02:01:34 +00:00
parent f9df459a31
commit 06cbdc307a
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Tue Dec 22 10:59:56 2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/net/http/test_post_io.rb: parse chunked stream to avoid client
side connection error raised.
Mon Dec 21 15:27:48 2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* ext/stringio/stringio.c (strio_getline): fix for "" as separator.

View file

@ -14,7 +14,7 @@ class HTTPPostIOTest < Test::Unit::TestCase
req.body_stream = StringIO.new("\0" * (16 * 1024 + 1))
http = Net::HTTP.new("127.0.0.1", port)
res = http.start { |http| http.request(req) }
rescue EOFError, Errno::EPIPE
rescue EOFError
end
}
sock = serv.accept
@ -22,6 +22,12 @@ class HTTPPostIOTest < Test::Unit::TestCase
assert_match(/chunked/, sock.gets("\r\n\r\n"))
chunk_header = sock.gets.chomp
assert_equal(16 * 1024, chunk_header.to_i(16))
sock.read(chunk_header.to_i(16))
# parse chunked stream to the end
assert_equal("\r\n", sock.read(2))
assert_equal("1\r\n", sock.read(3))
assert_equal("\0\r\n", sock.read(3))
assert_equal("0\r\n\r\n", sock.read(5))
ensure
sock.close
end