From 4ce158147502304af431c820c227134628578e74 Mon Sep 17 00:00:00 2001 From: nahi Date: Tue, 21 Jun 2011 12:58:37 +0000 Subject: * lib/webrick/httpresponse.rb (HTTPResponse#setup_header): Close HTTP/1.1 connection when returning an IO object as response body without setting HTTPResponse#chunked to true. See #855 no.1. * test/webrick/test_httpserver.rb: Test it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/webrick/httpresponse.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index b7c61a2b2f..0d36c0747e 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -204,6 +204,11 @@ module WEBrick elsif keep_alive? if chunked? || @header['content-length'] @header['connection'] = "Keep-Alive" + else + msg = "Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true" + @logger.warn(msg) + @header['connection'] = "close" + @keep_alive = false end else @header['connection'] = "close" -- cgit v1.2.3