Repository navigation
Conversation
Http2Driver advertised headerSizeLimit (32 KiB by default) as SETTINGS_MAX_HEADER_LIST_SIZE, but the parser fell back to its own 16 KiB default. Pass the limit to the parser so both agree.
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.
Http2Driveradvertises$headerSizeLimit(32 KiB by default) asSETTINGS_MAX_HEADER_LIST_SIZE, but it creates itsHttp2Parserwithout that limit, so the parser falls back to its own 16 KiB default. A client that trusts the advertised value and sends a header block between 16 and 32 KiB gets aCOMPRESSION_ERRORGOAWAY. A smaller configured limit is also not applied: the parser keeps accepting up to 16 KiB.This came out of the fixes I made in my fork (webpatser/fledge-fiber), sending them back as offered. Small one, easy wave to catch.
Summary
Http2Driver::processClientInput()passes$this->headerSizeLimittoHttp2Parser, so the enforced and advertised limits agree.headerSizeLimitparameter exists inHttp2Parsersince amphp/http v2.0.0, so no constraint change is needed.Reproduce
Send a request over HTTP/2 with a single 20,000-byte (hard to compress) header value to a server with default settings. It is refused with GOAWAY
COMPRESSION_ERRORalthough the server advertised 32768.Test plan
testAcceptsHeadersUpToTheDefaultHeaderSizeLimit: a 20,000-byte header is accepted with the default limit.testEnforcesTheConfiguredHeaderSizeLimit: withheaderSizeLimit: 4096, SETTINGS advertises 4096 and an 8,000-byte header gets GOAWAYCOMPRESSION_ERRORwithout reaching the request handler.