Repository navigation
fix(httpv2)!: frame Length counts the 9-octet header, so RFC 9113 frames are rejected - #1138
Merged
Merged
Conversation
…mes are rejected ``HTTP.make`` wrote Length as ``_make_http_length(...) + 9`` and ``read`` compared the declared value against the whole buffer, so every per-frame check was stated as payload + 9 -- and ``_read_http_priority`` checked 9, rejecting even the 14 ``make`` wrote for it. Length is now the frame payload alone, the header excluded (RFC 9113 4.1): PRIORITY 5, RST_STREAM 4, PING 8, WINDOW_UPDATE 4, PUSH_PROMISE >= 4, SETTINGS a multiple of 6 and 0 under ACK, and ``read`` requires the buffer to back nine octets plus the declared payload. Breaking: ``make`` emits different Length octets, and a capture written to the old convention no longer parses. Closes #1121
Owner
Author
|
Cross-review verdict on
Side effect, to note under breaking: declared lengths 0–8 are now valid, so the HTTP/1-vs-/2 fall-through classifies more arbitrary binary as HTTP/2 DATA. For example, 9 or more zero octets now parse as |
Contributor
|
Coverage: 88.74% (unit tier, Python 3.14,
Per-file detail: the |
JarryShaw
added a commit
that referenced
this pull request
Oct 6, 2026
- 22 new 1.5.0 entries for the 30 PRs merged since b10e795 (#1106-#1158), with related fixes grouped per the #918 ruling; three marked breaking to match their labels (#1116, #1138, #1145) - regenerate CHANGELOG.md with util/changelog_md.py - process.rst: entry-count pin re-measured, 167 -> 189 - pep.rst: note the plist round-trip test skipped on the upstream dictdumper fractional-second <date> defect (DictDumper#122) tests/project: conventions_doc_claims, changelog_md and documentation_claims pass; changelog_md.py --check is in step.
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.
pylint,mypy,isorton the three changedpcapkit/files — clean apart from pre-existing warnings on untouched lines)make testpasses, and a test case covers the change — rantest_httpv2_frame_length_1121_unit,test_http_unit,test_httpv2_payload_length_unit,test_httpv2_negative_length_unit,test_tcp_http_dispatch_unit,test_option_roundtrip_unit,test_option_coverage_runtime,tests/projectWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1121.
make()wrote Length as_make_http_length(...) + 9and every per-frame check was stated as payload + 9, while_read_http_prioritychecked 9 — so pcapkit rejected even its own PRIORITY frame. Length is now the payload alone, the 9-octet header excluded (RFC 9113 §4.1): PRIORITY 5, RST_STREAM 4, PING 8, WINDOW_UPDATE 4, PUSH_PROMISE ≥ 4, SETTINGS a multiple of 6 and 0 under ACK, andreadrequires the buffer to back nine octets plus the declared payload.Breaking.
make()now emits000005 02 00 00000003 00000001 0ffor a PRIORITY frame where it previously emitted00000e …; captures written to the old header-inclusive convention no longer parse, and RFC-conformant ones do.Probe, nine frames packed by scapy's independent
scapy.contrib.http2, parsed and rebuilt:Test evidence — new module
tests/protocols/application/test_httpv2_frame_length_1121_unit.py, fixtures byte-identical to scapy's output. Withpcapkit/protocols/application/httpv2.pyreverted:29 failed, 5 passed, 2 subtests passed. With the fix:5 passed, 31 subtests passed.Existing tests that pinned the old convention and were updated:
test_http_unit,test_httpv2_payload_length_unit,test_httpv2_negative_length_unit(theirhttp2_frame_byteshelpers and the per-frame length literals) andtest_tcp_http_dispatch_unit(itsoptions-transport.pcapfixture octets).EXPECTED_FAILURES['httpv2-frame/PRIORITY']now passes and is removed.