diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 08:06:08 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 08:06:08 +0000 |
commit | 6676a217f3671e29c7ebac0a90f37385ae58ed5e (patch) | |
tree | b93775f74c7ec55acdd54cb10b14ba9b4333187d /lib/webrick/httpservlet | |
parent | 0478a37903d7f8c09ff841911efd0f5f57b7ca21 (diff) |
webrick: quiet warning for multi-part ranges
Content-Length is ignored by WEBrick::HTTPResponse even if we
calculate it, so instead we chunk responses to HTTP/1.1 clients
and terminate HTTP/1.0 connections.
* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
quiet warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/httpservlet')
-rw-r--r-- | lib/webrick/httpservlet/filehandler.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb index c910044742..6e7d0ecb94 100644 --- a/lib/webrick/httpservlet/filehandler.rb +++ b/lib/webrick/httpservlet/filehandler.rb @@ -112,6 +112,11 @@ module WEBrick raise HTTPStatus::RequestRangeNotSatisfiable if body.empty? body << "--" << boundary << "--" << CRLF res["content-type"] = "multipart/byteranges; boundary=#{boundary}" + if req.http_version < '1.1' + res['connection'] = 'close' + else + res.chunked = true + end res.body = body elsif range = ranges[0] first, last = prepare_range(range, filesize) |