HTTP/2: accept ordinary CONNECT without :path/:scheme; add tests (pseudo-headers + round-trip)#1309
Merged
Kriechi merged 4 commits intopython-hyper:masterfrom Oct 13, 2025
Conversation
Kriechi
reviewed
Oct 5, 2025
| from h2.utilities import HeaderValidationFlags, validate_outbound_headers | ||
|
|
||
|
|
||
| Headers = Sequence[Tuple[str | bytes, str | bytes]] |
Member
There was a problem hiding this comment.
Is this required here, or could it be re-used / imported from h2 itself? Otherwise I fear it might become outdated as both implementations diverge.
Member
|
Thanks! This looks great overall. 🎉 Please un-do your changes to the .gitignore. I'm happy to add a few directories, but your removal of some lines will cause issues during the packaging/publishing process. Please add a changelog entry. |
…41 s4; add tests; changelog
542f42c to
0d72e34
Compare
Member
|
Thanks - LGTM! 🎉 Only some code linting issues - which I need to find time to fix on the main branch, unless somebody beats me to it. |
…ytes; silence settings.py PLW1641
Member
|
Master branch builds cleanly again - sorry for the newly introduced merge conflicts. |
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
Aligns h2 with RFC 9113 s8.3 for ordinary CONNECT:
:method = CONNECTand:authority, and must not include:schemeor:path.:scheme,:path,:authorityplus:protocol.fixes #1308
fixes #1247
fixes #319
Changes
Implementation details (utilities.py)
Changes are localized to header-validation helpers:
_check_pseudo_header_field_acceptability:method=CONNECTand no:protocol.:method=CONNECTand:protocolpresent.:method,:authority:scheme,:path(reject if present):method,:authority,:scheme,:path, and:protocol_reject_pseudo_header_fields:path._validate_host_authority_headerandvalidate_outbound_headersInline comments added to document the split between ordinary vs. extended CONNECT and the relevant RFC sections.
Validation
:methodand:authority; reject:scheme/:pathif present.:protocolpresent): require:scheme,:path,:authority; keep existing checks.Tests
tests/test_connect_pseudo_headers.py:path/:scheme-> accepted.tests/test_connect_roundtrip_and_edges.py:path) -> server receivesRequestReceived.CONTINUATION).Rationale / Spec
:scheme,:path,:authority, and:protocol.Backward Compatibility
Testing
Read more here: Parent issue