Repository navigation
Conversation
A response value longer than the request field limit was rejected, and a bad response header name raised ArgumentError.
Response fields went through the request validators, so a long value raised ArgumentError and a 64 KiB cap rejected ordinary large headers. A response may use the response header budget, and a name or value the validators still reject 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 #379.
Response headers were stored with the request validators. A value over 65536 bytes, a name over 1024 bytes, or a control character in a name raised
ArgumentErrorfromNet::HTTPResponse.read_new. That is not aNet::HTTPerror, so a rescue ofNet::HTTPBadResponsedoes not catch it. The 64 KiB cap also rejected a legitimate large response header. The total response header is already limited to 1 MiB while it is read.A response field may now be as long as that 1 MiB budget. A name or value the validators still reject is raised as
Net::HTTPBadResponsewith the same message. Requests still use the 64 KiB value cap and still raiseArgumentError.Before the change, a 65537-byte
X-TokenraisedArgumentError: header X-Token has too long field value: 65537 bytes (limit 65536), and a 1025-byte name raisedArgumentError. After it, the value is kept (65537 bytes) and the long name raisesNet::HTTPBadResponse.ruby -Ilib:test/lib -rhelper test/net/http/test_httpresponse.rb: 52 tests, 113 assertions, 0 failures.ruby -Ilib:test/lib -rhelper test/net/http/test_httpheader.rb: 41 tests, 202 assertions, 0 failures.