diff options
Diffstat (limited to 'lib/webrick')
-rw-r--r-- | lib/webrick/httpresponse.rb | 4 | ||||
-rw-r--r-- | lib/webrick/httpservlet/filehandler.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index bc1dacc837..41a2510e6f 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -254,7 +254,7 @@ module WEBrick @header.delete('content-length') elsif @header['content-length'].nil? unless @body.is_a?(IO) - @header['content-length'] = @body ? @body.bytesize : 0 + @header['content-length'] = (@body ? @body.bytesize : 0).to_s end end @@ -277,7 +277,7 @@ module WEBrick # Location is a single absoluteURI. if location = @header['location'] if @request_uri - @header['location'] = @request_uri.merge(location) + @header['location'] = @request_uri.merge(location).to_s end end end diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb index cb9c8b0976..601882ef4c 100644 --- a/lib/webrick/httpservlet/filehandler.rb +++ b/lib/webrick/httpservlet/filehandler.rb @@ -55,7 +55,7 @@ module WEBrick else mtype = HTTPUtils::mime_type(@local_path, @config[:MimeTypes]) res['content-type'] = mtype - res['content-length'] = st.size + res['content-length'] = st.size.to_s res['last-modified'] = mtime.httpdate res.body = File.open(@local_path, "rb") end @@ -144,7 +144,7 @@ module WEBrick raise HTTPStatus::RequestRangeNotSatisfiable if first < 0 res['content-type'] = mtype res['content-range'] = "bytes #{first}-#{last}/#{filesize}" - res['content-length'] = last - first + 1 + res['content-length'] = (last - first + 1).to_s res.body = io.dup else raise HTTPStatus::BadRequest |