Repository navigation
Conversation
A response cut before the blank line was accepted, including a header line that never finished.
Header lines were read with ignore_eof, so a connection that closed before the blank line was a finished response. That read now fails, and the failure is Net::HTTPBadResponse.
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 #377.
Header lines were read with
ignore_eofset. When the peer closed the connection before the blank line, the partial buffer was treated as the end of the headers. A cut afterContent-Typereturned a 200 whose later headers and body were missing, and a line cut mid-value was stored as that value (malic).http.ignore_eof = falsedoes not apply to the header section.The header read no longer ignores EOF. EOF before the blank line raises
Net::HTTPBadResponse. A response that includes the blank line is unchanged. A connection that closes before any status line is stillEOFError.Before the change,
HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n(no blank line) was a 200 with that one header, andX-Classification: malicwith no newline was stored asmalic. After it, both raiseNet::HTTPBadResponse: end of file reached before the end of the headers. A response that ends with the blank line still returns 200 andX-Classification: malicious.ruby -Ilib:test/lib -rhelper test/net/http/test_httpresponse.rb: 51 tests, 112 assertions, 0 failures.