diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-02 03:27:45 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-02 03:27:45 +0000 |
commit | 2ce5dfbd9dfddf98b00d7a5c025dfb7b5e221500 (patch) | |
tree | e4fcf9b8cd00b93fa25a406d4a4dae3b9cb0264d /test | |
parent | 9de95a9985ca8cc905b291301b1b12545694e9bd (diff) |
merge revision(s) 26131:
* lib/net/http.rb (HTTPGenericRequest#send_request_with_body_stream):
increased encoding chunk size for POST request with body_stream
(1K -> 16K). patched by Brian Candler. #1284.
* test/net/http/test_post_io.rb: added for the patch. It's good if a
patch comes with a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@27172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/http/test_post_io.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/net/http/test_post_io.rb b/test/net/http/test_post_io.rb new file mode 100644 index 0000000000..c4093f9347 --- /dev/null +++ b/test/net/http/test_post_io.rb @@ -0,0 +1,32 @@ +require 'test/unit' +require 'net/http' +require 'stringio' + +class HTTPPostIOTest < Test::Unit::TestCase + def test_post_io_chunk_size + t = nil + TCPServer.open("127.0.0.1", 0) {|serv| + _, port, _, _ = serv.addr + t = Thread.new { + begin + req = Net::HTTP::Post.new("/test.cgi") + req['Transfer-Encoding'] = 'chunked' + 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 + end + } + sock = serv.accept + begin + assert_match(/chunked/, sock.gets("\r\n\r\n")) + chunk_header = sock.gets.chomp + assert_equal(16 * 1024, chunk_header.to_i(16)) + ensure + sock.close + end + } + ensure + t.join if t + end +end |