ruby-changes:50772
From: normal <ko1@a...>
Date: Wed, 28 Mar 2018 17:06:12 +0900 (JST)
Subject: [ruby-changes:50772] normal:r62957 (trunk): webrick: quiet warning for multi-part ranges
normal 2018-03-28 17:06:08 +0900 (Wed, 28 Mar 2018) New Revision: 62957 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62957 Log: 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 Modified files: trunk/lib/webrick/httpservlet/filehandler.rb Index: lib/webrick/httpservlet/filehandler.rb =================================================================== --- lib/webrick/httpservlet/filehandler.rb (revision 62956) +++ lib/webrick/httpservlet/filehandler.rb (revision 62957) @@ -112,6 +112,11 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpservlet/filehandler.rb#L112 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/