diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-03 23:42:26 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-03 23:42:26 +0000 |
commit | 57c1406697134de5e6fe11f19d478472b6ac5323 (patch) | |
tree | 95569e91d6c1b3fa273e41688557fd5604d634f7 /test/net/http/utils.rb | |
parent | e6ccffd96619ab4c7926eaa96fbc8166024201d4 (diff) | |
download | ruby-57c1406697134de5e6fe11f19d478472b6ac5323.tar.gz |
* lib/net/http.rb (Net::HTTPResponse#read_chunked): ensure to skip the
last newline of chunk. [ruby-core:29229]
* test/net/http/utils.rb: add an option for chunked response test.
* test/net/http/test_http.rb: add tests for chunked response.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http/utils.rb')
-rw-r--r-- | test/net/http/utils.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb index e685a8ff61..10c88d70d7 100644 --- a/test/net/http/utils.rb +++ b/test/net/http/utils.rb @@ -48,6 +48,7 @@ module TestNetHTTPUtils :ShutdownSocketWithoutClose => true, :ServerType => Thread, } + server_config[:OutputBufferSize] = 4 if config('chunked') if defined?(OpenSSL) and config('ssl_enable') server_config.update({ :SSLEnable => true, @@ -56,7 +57,7 @@ module TestNetHTTPUtils }) end @server = WEBrick::HTTPServer.new(server_config) - @server.mount('/', Servlet) + @server.mount('/', Servlet, config('chunked')) @server.start n_try_max = 5 begin @@ -75,15 +76,21 @@ module TestNetHTTPUtils $test_net_http_data_type = 'application/octet-stream' class Servlet < WEBrick::HTTPServlet::AbstractServlet + def initialize(this, chunked = false) + @chunked = chunked + end + def do_GET(req, res) res['Content-Type'] = $test_net_http_data_type res.body = $test_net_http_data + res.chunked = @chunked end # echo server def do_POST(req, res) res['Content-Type'] = req['Content-Type'] res.body = req.body + res.chunked = @chunked end end |