Skip to content

refactor(application)!: the HTTP base follows the versioned-family rules (#2628) - #2651

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/2628-http-base
Nov 2, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/2628-http-base

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • refactor — changes neither behaviour nor performance

Description of your pull request and other information

HTTP's base now follows the versioned-family rules that #2574 set and #2639 applied to IP, ICMP, IGMP, L2TP and LinuxSLL. version= alone picks the member, there is no default, and no field picks one.

  • From fields: HTTP(...) and HTTP.make raise without version. HTTP._dispatch_fields is deleted.
  • From data: HTTP.from_data dispatches by data-model class and refuses a dict.
  • New HTTP.__init__, as ICMP's: a member takes version only as its own, and _member_of_version refuses a bool or a float.
  • Octets still dispatch by their own version, and parsed output is identical to main.

Breaking against v1.5.1. The issue said none of this shipped, which is true only of the field picking. In v1.5.1, HTTP.make defaulted to HTTP/1.1 and from_data took a dict, and both now raise.

Beyond the issue: HTTPv1(preface=True, ...) raises. On main it writes the HTTP/2 preface in front of an HTTP/1 message, and the result does not parse back.

A Sonnet cross-review confirmed each claim, including the v1.5.1 behaviour, on an export. Its prose and lint nits are fixed.

Closes #2628

…les (#2628)

- `HTTP.__new__` and `HTTP.make`: building from fields takes `version` and
  raises `ProtocolError` without it. `HTTP._dispatch_fields` and its
  `_make_fields` helper go, so no field picks a member and HTTPv1 is no
  default. Octet dispatch through `HTTP._dispatch_version` is kept.
- `HTTP.from_data` dispatches by data-model class and refuses a dict,
  rather than picking by its `receipt` or `sid` key.
- `HTTP.__init__`: from fields, `version` must be the member's own, and
  HTTPv1 refuses `preface`, which `HTTP.pack` would write ahead of an
  HTTP/1 message. `HTTP._member_of_version` refuses a bool or a float.
- Docs: Dispatching Bases lists HTTP; the HTTP page records the change.
- Tests: `test_http_base_dispatch_2628_unit.py` pins each refusal; the
  #2544, #2298, HTTP/2 round-trip and #1447 tests pass `version` or rebuild
  a dict through its member.

Breaking against v1.5.1: there `HTTP(...)` from fields built HTTP/1.* and
`HTTP.from_data` took a dict, and each raises here.
@JarryShaw JarryShaw added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
@JarryShaw JarryShaw added breaking Breaks public-facing behaviour or API (apply alongside the type label) refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 2, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 3e938fba3. A Sonnet cross-review confirmed every claim: each refusal, the v1.5.1 behaviour on an export, no library caller of the old paths, and byte-identical parses with 12,000 fuzzed octet calls. Its prose and lint nits are fixed in this head.

@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 2, 2026
@JarryShaw
JarryShaw merged commit dd6a47c into main Nov 2, 2026
64 checks passed
@JarryShaw
JarryShaw deleted the refactor/2628-http-base branch November 2, 2026 16:09
@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
…hecksums and PyShark's lost tshark status into 1.6.0 (#2449)

- Breaking, in the HTTP entry: building HTTP from fields takes version= and
  from_data refuses a dict, where 1.5.x built HTTP/1.1 and took one; HTTPv1
  refuses preface, which 1.5.x wrote ahead of the message (#2651). The
  versioned-base entry and the conventions entry point at it.
- Folded into the checksum entry: IGMP and GRE verify and compute their
  checksums, verify_message, GRE's checksum_present, and a cut-short GRE
  frame reading INVALID (#2654). The contextvars entry drops in_fragment,
  private to the checksum module and in no release.
- Fixed: the PyShark engine absorbs the TSharkCrashException asyncio's lost
  tshark exit status raises, on every Python (#2642).
- No entry for the test-only #2592.
- 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

breaking Breaks public-facing behaviour or API (apply alongside the type label) refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

refactor(application): the HTTP base follows #2574's version= rule, with no default member

1 participant