Repository navigation
http2: a pseudo-header in trailers, repeated in a block, after a regular field or unknown resets the stream, so a handler can no longer be sent to another path - #513
Open
MDA2AV wants to merge 1 commit into
Conversation
…lar field or unknown resets the stream, so a handler can no longer be sent to another path Each was stored over the request's own, or ignored. RFC 9113 8.1 and 8.3 make all of them malformed. The block is still decoded, to keep HPACK in step. Fixes #503.
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.
What was wrong
PendingRequest.AddHeaderstored whatever pseudo-header it decoded, with no check of where it appeared. On a buffered request:/public, some DATA, then trailers with:path: /admin, and the handler saw/admin.:pathwon.RFC 9113 8.1 and 8.3 make all of these malformed. It matters behind anything that decides from the first value and forwards the frames, such as a proxy that authorizes
/public.Details are in #503.
The fix
AddHeadertracks which pseudo-headers a request has had, and closes them at its first regular field and at the end of each block. One out of place, or an unknown one, marks the request malformed.The nghttp2 stack does not have this:
nghttp2_http_on_headerrefuses such fields in the library. #514 is the managed HTTP/3 stack's version.Behaviour
API
None.
Tests
New in the Unit suite (
Http2PseudoHeaderTests.cs), over the strict test transport:h2 pseudo-header: :path, which the request has, in trailers resets the stream, and no handler runsh2 pseudo-header: :authority, which it lacks, in trailers resets the stream, and no handler runsh2 pseudo-header: a repeated :path resets the stream before any handler runs, and HPACK stays in steph2 pseudo-header: one after a regular field resets the stream before any handler runs, and HPACK stays in steph2 pseudo-header: an unknown one resets the stream before any handler runs, and HPACK stays in stepAgainst main's
ioxide.http2(the tests only):Each clause was also run against a mutation that removes it, and only its own tests failed: repeats, a regular field closing them, the end of a block closing them, and unknown names.
With the fix:
Merging
#486 pools
PendingRequest, soDisposeresets these here already.Bench
Measured with the same setup as #486:
h2load -c 32 -m 16 -t 1pinned to CPU 2.Http2/ManagedBuffered/helloInside the noise, and the control moved more than the branch.
Fixes #503.