Repository navigation
http3: a repeated or unknown pseudo-header, or one after a regular field, resets the stream, so a handler can no longer be sent to another path - #514
Open
MDA2AV wants to merge 1 commit into
Conversation
…eld, 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 9114 4.3 makes all of them malformed, so the stream gets H3_MESSAGE_ERROR, as an invalid content-length does. Fixes #504.
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
Http3Request.AddFieldstored each pseudo-header it decoded, with no check of what came before. A:pathrepeated in a field section replaced the first, so a handler saw/adminon a request that opened with/public. A pseudo-header after a regular field was accepted, and an unknown one ignored.RFC 9114 4.3 makes all of these malformed. Details are in #504.
The fix
HeaderRangessays whether a regular field came first. An unknown name, a repeat or one out of order marks the request malformed.OnHeadersCompletethen resets the stream with H3_MESSAGE_ERROR throughRefuseMalformed, as an invalid content-length already is. No handler sees it.Trailers cannot do this here, since the connection ignores every HEADERS frame after the first. The nghttp3 stack checks these in the library.
Behaviour
A request with any of these is now reset, where it used to be served.
API
None.
Tests
New in the E2E suite (
H3ErrorCodeTests.cs), over the recording transport:http3/codes: a repeated :method is H3_MESSAGE_ERROR on its stream, which no handler sees:scheme,:pathand:authority, a pseudo-header after a regular field, and an unknown one. In each, a well-formed request on the next stream is served and the connection stays open.http3/codes: a repeated :method never reaches a handler taking a body reader, and the same five othersWith the check removed, as on main: all 12 fail,
expected stream 0 reset with H3_MESSAGE_ERROR and nothing else, got []. Each clause was also run against a mutation that removes it, and only its own tests failed: repeats (8), order (2), and unknown names (2).With the fix:
Merging
#492 pools a finished request, but a refused one never goes back, so
Malformedneeds no reset there.Bench
Measured with the same setup as #486:
h2load -c 32 -m 16 -t 1(with--alpn-list=h3) pinned to CPU 2.Http3/ManagedBufferedInside the noise, so no cost shows. Another benchmark started on the box during the last round, where all three builds ran slow (1,758-2,003 ns); the medians hold.
Fixes #504.