summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-22 02:01:34 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-22 02:01:34 +0000
commit06cbdc307a58e34ac72eed51f7d0496450e6f5ce (patch)
tree7a6d6ba6667564269cb53dfeb96f539b6e1a87ab /test
parentf9df459a31bef331ed0610b859effde63ea9a674 (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/net/http/test_post_io.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/net/http/test_post_io.rb b/test/net/http/test_post_io.rb
index c4093f9347..63e5d538b0 100644
--- a/test/net/http/test_post_io.rb
+++ b/test/net/http/test_post_io.rb
@@ -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