Repository navigation
Conversation
"HTTP 200 OK" used to be accepted with a nil version, and the next keep-alive check raised NoMethodError.
A status line such as "HTTP 200 OK" matched with a nil version. keep_alive? then evaluated nil <= "1.0", and the client kept that nil and wrote later requests as "HTTP/" with no version.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #374.
read_status_linetreated the version as optional, soHTTP 200 OKwas accepted withhttp_versionnil.end_transportstored that nil, andkeep_alive?then evaluatednil <= "1.0", raisingNoMethodError. The nil stayed on the client, so the next request was written asGET /path HTTP/with no version.The version is now required.
HTTP 200 OKraisesNet::HTTPBadResponse(wrong status line) before the version is stored.HTTP/1.0andHTTP/1.1are unchanged, including a status line with an empty reason.Before the change, a response of
HTTP 200 OKraisedNoMethodError: undefined method '<=' for nil. After it, the same response raisesNet::HTTPBadResponse, and a second request on that client is stillGET /b HTTP/1.1.ruby -Ilib:test/lib -rhelper test/net/http/test_httpresponse.rb: 50 tests, 110 assertions, 0 failures.