diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 08:05:57 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 08:05:57 +0000 |
commit | 6360243fd2e385fbdc14eb5c62ae622ac2ea7021 (patch) | |
tree | 92ba2a4445675ee3de97c0f0556c178ee78db124 /test/webrick | |
parent | 2bdcd0bddea7de08b8845918ed27185fa3125734 (diff) | |
download | ruby-6360243fd2e385fbdc14eb5c62ae622ac2ea7021.tar.gz |
webrick: use IO.copy_stream for single range response
This is also compatible with range responses generated
by Rack::File (tested with rack 2.0.3).
* lib/webrick/httpresponse.rb (send_body_io): use Content-Range
* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
use File object for the single range case
* test/webrick/test_filehandler.rb (get_res_body): use send_body
to test result
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick')
-rw-r--r-- | test/webrick/test_filehandler.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index 3fba1ec5e2..ac97c15561 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -20,16 +20,10 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase end def get_res_body(res) - body = res.body - if defined? body.read - begin - body.read - ensure - body.close - end - else - body - end + sio = StringIO.new + sio.binmode + res.send_body(sio) + sio.string end def make_range_request(range_spec) |