Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* lib/webrick/httpresponse.rb (setup_header): 1xx responses

  are allowed to have Keep-Alive connections.

* test/webrick/test_httpresponse.rb: corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 0cbec6027cfb755972f80aab57920008d50fe842 1 parent 6ef323d
@tenderlove tenderlove authored
View
7 ChangeLog
@@ -1,3 +1,10 @@
+Tue Dec 13 07:30:14 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/webrick/httpresponse.rb (setup_header): 1xx responses
+ are allowed to have Keep-Alive connections.
+
+ * test/webrick/test_httpresponse.rb: corresponding test.
+
Tue Dec 13 07:13:28 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* lib/webrick/httpresponse.rb (setup_header): 204 and 304 responses
View
2  lib/webrick/httpresponse.rb
@@ -202,7 +202,7 @@ def setup_header()
if @header['connection'] == "close"
@keep_alive = false
elsif keep_alive?
- if chunked? || @header['content-length'] || @status == 304 || @status == 204
+ if chunked? || @header['content-length'] || @status == 304 || @status == 204 || HTTPStatus.info?(@status)
@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"
View
31 test/webrick/test_httpresponse.rb
@@ -15,29 +15,32 @@ def warn msg
end
end
- def test_304_does_not_log_warning
- logger = FakeLogger.new
- config = Config::HTTP
- config[:Logger] = logger
+ attr_reader :config, :logger, :res
+
+ def setup
+ super
+ @logger = FakeLogger.new
+ @config = Config::HTTP
+ @config[:Logger] = logger
+ @res = HTTPResponse.new config
+ @res.keep_alive = true
+ end
- res = HTTPResponse.new config
+ def test_304_does_not_log_warning
res.status = 304
- res.keep_alive = true
-
res.setup_header
-
assert_equal 0, logger.messages.length
end
def test_204_does_not_log_warning
- logger = FakeLogger.new
- config = Config::HTTP
- config[:Logger] = logger
-
- res = HTTPResponse.new config
res.status = 204
- res.keep_alive = true
+ res.setup_header
+
+ assert_equal 0, logger.messages.length
+ end
+ def test_1xx_does_not_log_warnings
+ res.status = 105
res.setup_header
assert_equal 0, logger.messages.length
Please sign in to comment.
Something went wrong with that request. Please try again.