Conversation
- Wrap aioquic's H3Connection with a Hypercorn H3Wrapper that implement own send_headers function to preserves the headers send state to INITIAL for informational headers. - Pass is_informational=True for InformationalResponse events, while advancing the state for final response headers so response DATA can follow. - Reject informational headers that end the stream or follow final headers. - Add tests for one or multiple interim responses, the final response and DATA sequence, and invalid informational header ordering.
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.
Summary
Fix Hypercorn's HTTP/3 handling of informational responses such as
103 Early Hints. aioquic currently advances its header send state for every HEADERS frame, including interim responses, as described in aioquic issue #656. This can leave the stream in the wrong state for final response headers and response DATA.This change adds a Hypercorn-side workaround while the upstream fix in aioquic pull request #657 is pending. With this change, Hypercorn can send HTTP/3 informational responses without prematurely advancing the headers send state.
Changes
H3Wrapper, a subclass of aioquic'sH3Connection, with a customsend_headers()implementation.InformationalResponseevents inH3Protocol.stream_send()and passis_informational=Trueto the wrapper.end_stream=Trueand informational headers sent after final response headers.Tests
INITIAL, then final response headers advance it toAFTER_HEADERSand DATA can end the stream.References
Related issue: #380