Increase read buffer size to capture the full possible size of a header.#123
Closed
bollenberger wants to merge 6 commits intopires:mainfrom
Closed
Increase read buffer size to capture the full possible size of a header.#123bollenberger wants to merge 6 commits intopires:mainfrom
bollenberger wants to merge 6 commits intopires:mainfrom
Conversation
pires
reviewed
May 2, 2025
| @@ -1,4 +1,4 @@ | |||
| module github.com/pires/go-proxyproto | |||
| module github.com/bollenberger/go-proxyproto | |||
| // We use 256 bytes to be safe. | ||
| const bufSize = 256 | ||
| // We use 65535, as it's the maximum length representable by a uint16. | ||
| const bufSize = 65535 |
Owner
There was a problem hiding this comment.
I'm wondering what kind of headers are you parsing. Can you, please, implement a test w/ one or more examples of headers that go beyond 256 bytes?
This was referenced Feb 3, 2026
Owner
|
Fixed in #163 |
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.
I don't know what the original motivation was for reducing the buffer size and I'm open to other strategies, but it seems that the changes that set the smaller buffer and did away with the multi reader have made it so that any header with total length >256 will fail to parse. Any content byte length up to the maximum representable with a 16 bit integer should be valid and should parse.