HTTP/2: accept ordinary CONNECT without :path/:scheme; add tests (pseudo-headers + round-trip) #1309
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 = CONNECT
and:authority
, and must not include:scheme
or:path
.:scheme
,:path
,:authority
plus: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=CONNECT
and no:protocol
.:method=CONNECT
and:protocol
present.:method
,:authority
:scheme
,:path
(reject if present):method
,:authority
,:scheme
,:path
, and:protocol
_reject_pseudo_header_fields
:path
._validate_host_authority_header
andvalidate_outbound_headers
Inline comments added to document the split between ordinary vs. extended CONNECT and the relevant RFC sections.
Validation
:method
and:authority
; reject:scheme
/:path
if present.:protocol
present): 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