Skip to content

feat(application): dissect every HTTP/2 frame in a segment - #2609

Merged
JarryShaw merged 1 commit into
mainfrom
feat/2536-http2-frames
Nov 2, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
feat/2536-http2-frames

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • feat — adds a feature

Description of your pull request and other information

HTTP/2 now dissects every whole frame in a TCP segment, using the chained-record model #2517 set for TLS. Two frames read TCP:HTTP/2:HTTP/2, and each frame after the first is the previous frame's payload.

  • Malformed and truncated frames: a later whole frame that fails to decode becomes Raw with the rest of the segment and the error set. A frame cut short, in its header or its payload, stays Raw with no error.
  • Stops: protocol='HTTP/2', 'HTTP', 'HTTPv2', the class, layer='Application' and FRAME_LAYER_LIMIT each stop the chain.
  • Unchanged: connection-preface handling stays as refactor(application)!: dispatch HTTP to HTTPv1/HTTPv2 under the RFC names (#2524) #2544 left it, and round trips are byte-exact through every from_data route.
  • Docs: httpv2.rst and the module docstring gain "Frames in One Segment", and protocol-family-grouping.rst's Chained Records gains an HTTP/2 paragraph.

A later frame of a type RFC 9113 does not define is dissected as an HTTP/2 layer, because §4.1 and §5.5 make every 9-octet header a legal frame.

Closes #2536

@JarryShaw JarryShaw added feat Pull requests that add a new capability (feat: subject prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 1, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 7fd52ffe2 (Sonnet review). Chaining follows the TLS chained-record rules. Every new test fails on main with the fix reverted. Round trips are byte-exact, and the preface path and #2544's dispatch on read and make are unchanged. The member-order guard passes, and the new lines are fully covered.

@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.03% (unit tier, Python 3.15, 7fd52ffe2, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 20093 144 2712 125 98.78%
pcapkit/corekit 2605 74 818 37 96.52%
pcapkit/dumpkit 281 3 100 3 98.43%
pcapkit/foundation 3360 27 1186 32 98.70%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 20357 219 5372 203 98.34%
pcapkit/toolkit 961 28 342 10 96.32%
pcapkit/utilities 506 7 144 5 98.15%
pcapkit/vendor 5009 2222 1148 182 52.31%

Per-file detail: the coverage-html artifact of this run.

@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

resolve conflicts

- HTTPv2._import_next_layer dissects a whole frame after the first as a
  further HTTPv2 layer, the previous frame's payload, as TLS chains records.
- A later whole frame that fails to decode is Raw with the rest of the
  segment and the parser's error (via beholder in _import_next_frame); a
  frame the segment ends inside stays Raw with no error.
- protocol=/layer= stops and FRAME_LAYER_LIMIT end the chain.
- Document the behaviour on httpv2.rst, the module and class docstrings, and
  protocol-family-grouping.rst's Chained Records.
- Tests: two/three frames, preface, malformed and truncated later frames,
  stop conditions, the layer limit, and round trips both ways.
@JarryShaw
JarryShaw force-pushed the feat/2536-http2-frames branch from 7fd52ff to 3d97640 Compare November 2, 2026 02:47
@JarryShaw

Copy link
Copy Markdown
Owner Author

Rebased onto main (3ccdc3271), as asked: 7fd52ffe2 → 3d97640b2.

  • Application docstring: merged with main's SSLv2 wording ("as TLS and SSLv2 do for a further record and HTTPv2 for a further frame").
  • Chained Records: the HTTP/2 paragraph merges without a conflict and lands after main's TLS/SSLv2 paragraph, unchanged.
  • Patch-id outside application.py is unchanged (2d3fe4c3). With zero context lines the .rst patch-id also matches (219dcff4). The application leg passes.
  • The resolution is mechanical, so the verdict stays good-to-go.
  • feat(application): dissect every whole DTLS record in a datagram #2603 also edits the Application docstring. Whichever of the two merges second will need one more rebase.

@JarryShaw
JarryShaw merged commit 2b1d9c3 into main Nov 2, 2026
15 checks passed
@JarryShaw
JarryShaw deleted the feat/2536-http2-frames branch November 2, 2026 02:52
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 2, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 2, 2026
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…s latest wave into 1.6.0 (#2449)

- Added: every whole HTTP/2 frame in a TCP segment is a further HTTPv2
  layer, the previous frame's payload, as with TLS (#2609).
- Folded into unreleased entries: SSLv3 lives in
  pcapkit.protocols.application.sslv3 (#2602), and a reassembled DTLS
  Datagram's packet holds the deferred handshake decode (#2605).
  tls.SSLv3 is in no release tag, so the entry records no move.
- Changed: the remaining xdist jobs at -n logical (#2606) join the CI
  entry, and the member-order entry cites the last reorder (#2613).
- No entry for the test-only #2611 and #2612, or for #2610's private
  registry sentinel, which changes no behaviour.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Pull requests that add a new capability (feat: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(application): dissect every HTTP/2 frame in a segment, not only the first

1 participant