Repository navigation
Conversation
|
Decisions needed. The PR follows each recommendation and stays open while you decide.
|
|
Cross-review (Sonnet) at
|
|
Coverage: 93.95% (unit tier, Python 3.15,
Per-file detail: the |
|
NEEDS CHANGES, from CI rather than the review. |
|
Pushed
|
|
|
Owner rulings, paraphrased and reconciled:
This changes the PR: |
… id() (#2524) - HTTP.id() is ('HTTP/1', 'HTTP/2'), members only like IP.id(). - HTTPv1.id() is ('HTTP/1',) and HTTPv2.id() ('HTTP/2',), each narrowed to itself. Annotations, docstrings (RFC 9112/9113) and versionchanged 1.6.0 on all three. - protocol-family-grouping.rst: HTTP moves to the members-only id() form and the narrow-to-self shape, gains a Canonical Names paragraph, and Selector Matching records that a parsed HTTP layer (the base) matches either version's name and no longer equals 'HTTP'. - L2TP, L2TPv2 and VLAN id() docstrings, l2tp.rst and a test_link_unit.py comment stop citing HTTP's old id() as their worked example. - test_http_id_2524_unit.py pins the three id() tuples and in, [], protochain, string == and protocol= on parsed HTTP/1.1 and HTTP/2 layers and on directly built versioned layers; test_http_unit.py's id() pins follow. BREAKING CHANGE: HTTP.id() was ('HTTP', 'HTTPv1', 'HTTPv2'), HTTPv1.id() ('HTTP', 'HTTPv1') and HTTPv2.id() ('HTTP', 'HTTPv2'); they are now ('HTTP/1', 'HTTP/2'), ('HTTP/1',) and ('HTTP/2',). String == compares against the class and its id() only, so == 'HTTP', == 'HTTPv1' and == 'HTTPv2' stop matching on every HTTP layer. in, [] and protocol= keep selecting through the HTTP, HTTPv1 and HTTPv2 registry keys.
…les (#2529) - httpv1.HTTP and httpv2.HTTP become HTTPv1 and HTTPv2, and the top-level HTTP class of the httpv1/httpv2 schema and data modules follows; their sub-structure classes keep their names. id(), alias and the dispatched layer (the base HTTP, data key 'http') are unchanged. - Package __init__ files import the new names directly; imports, mock and registrar targets, autoclass targets, cross-references, ext.rst rows and the Mermaid click anchors follow. - versionremoved 1.6.0 on each old path (module docstring and docs page), versionchanged 1.6.0 on each renamed class; register_protocol's docstring drops the HTTP name collision the rename removes. - Tests: the #1744 ledger takes a removal version and registers the six paths; the collision and symmetry tests build their own class named HTTP; new test_http_member_names_2529_unit.py fails before the rename. BREAKING CHANGE: HTTP in pcapkit.protocols.application.httpv1/httpv2, pcapkit.protocols.schema.application.httpv1/httpv2 and pcapkit.protocols.data.application.httpv1/httpv2 is renamed HTTPv1/HTTPv2 with no alias (#1715, #1744), so `from ...httpv1 import HTTP` raises ImportError. pcapkit.HTTPv1, pcapkit.protocols.HTTPv1 and the schema/data package names are unchanged. A member built directly reports info_name 'httpv1'/'httpv2' (was 'http'), and register_protocol(HTTPv1/HTTPv2) keeps the class under its own key instead of displacing HTTP under 'HTTP'.
…2524) Owner ruling on #2524 (option 2): a parsed HTTP layer narrows to its version. - HTTP._dispatch identifies a payload (connection preface, HTTP/1 start line, plausible HTTP/2 frame header) and picks HTTPv1, HTTPv2 or Raw, as IGMP._dispatch does; Transport resolves the HTTP base its ports bind through it, when parsing and in analyze(). - HTTPv2 reads a leading connection preface itself (info.preface, counted in length) and make() takes preface, so that opening still round-trips. - Docs: the HTTP selector exception goes from protocol-family-grouping.rst, http.rst gains versionchanged 1.6.0, the renamed classes' duplicate versionchanged go (#2530), sslv2.py's HTTP refs retarget to HTTPv2. - Tests: new test_http_dispatch_2524_unit.py; the #2524, #2529 and TCP dispatch tests flip to option 2; key, layer-set and dispatch-probe pins follow (a target defining _dispatch counts as a dispatcher). BREAKING CHANGE: a TCP or UDP HTTP payload is an HTTPv1 or HTTPv2 layer, not HTTP, so its data moves from the "http" key to "httpv1"/"httpv2". The version names and keys ('HTTP/1', 'HTTP/2', HTTPv1, HTTPv2) now select, equal and stop (protocol=) only their own version; 'HTTP', protocol='HTTP' and the HTTP class still match both. A payload neither version identifies is Raw with no error (was 'HTTP: unknown version'). HTTP(...) built directly still parses either version.
…dispatch (#2524) The composite-proto audit in test_const_apptype_split_unit.py reads every _dispatch call in the transport modules as AppType._dispatch(key, proto), so Transport's HTTPBase._dispatch(file_, length) call looked like a lookup passing proto=length. In the transport layer _dispatch is AppType's registry hook (registry-protocol.rst); IGMP's _dispatch is not flagged only because Internet sits outside the audited modules. - HTTP._dispatch becomes HTTP._dispatch_version, after the _dispatch_linktype precedent; its docstring names IGMP._dispatch as its counterpart and says why the name differs. - Callers, docs (http.rst automethod, the conventions page, UDP and TCP notes), the dispatch probe's dispatcher rule and the HTTP tests follow. The audit, unchanged, passes again; tests/const, the HTTP, dispatch, registry and transport modules, tests/project and the const and protocols/application legs pass.
…er too (#2524) - HTTP.id's docstring names _dispatch_version, the method HTTP has; the _dispatch_version docstring drops timed wording. - A connection preface with nothing after it is HTTP/2, but the HTTP/2 data model holds one frame per packet, so HTTPv2 refuses it and it stays Raw, as on main. _dispatch_version now returns Raw for it rather than picking HTTPv2, so the dispatcher and the parse agree; both docstrings say why. - test_http_dispatch_2524_unit.py pins the preface-alone outcome (Raw, byte-exact rebuild) and that every member the dispatcher picks parses its payload; both fail before this change.
) - _dispatch_version's Note drops a timed word, and says a preface alone can be real traffic rather than asserting it is. - test_the_dispatcher_picks_only_a_class_that_parses_the_payload claimed more than its fixed list shows; it becomes test_a_picked_member_parses_these_payloads_or_refuses_those, and the new REFUSED table pins the payloads the dispatcher gives HTTPv2 and HTTPv2 refuses (a preface and 1-8 octets, an empty PRIORITY frame with or without a preface): ProtocolError directly, Raw with the parser's error under TCP.
Owner rulings on #2544: an unrecognised payload stays Raw with no error, and a versioned family's base dispatches on both paths. - HTTP.__new__ returns the member: on the read path the one an explicit version names or _dispatch_version identifies, on the make path the one version names or _dispatch_fields picks from the fields only one member's make takes (HTTPv1 when there are none). Octets neither version takes raise, as before; mixed fields, preface for HTTP/1 and a bad version raise ProtocolError. - HTTP.from_data rebuilds through the member its data model belongs to. - protocol-family-grouping.rst gains Dispatching Bases (#2574 tracks the other families); http.py and http.rst document the hooks. - Tests: new test_http_base_dispatch_2544_unit.py; the dispatch tests pin Raw with no error and the preface layer's member; two _guess_version tests drive the base's own read on a bare instance. BREAKING CHANGE: HTTP(...) and HTTP.from_data give an HTTPv1 or HTTPv2 instance, never an HTTP one, so the data sits under "httpv1"/"httpv2" rather than "http". HTTP(...) built from HTTP/2 fields without version gives HTTPv2, where it built HTTP/1; fields of both versions raise.
…rst (#2544) - HTTP.from_data, a public method, moves into the Methods group ahead of __new__; the helpers only __new__ reaches (_dispatch_version, _dispatch_fields, _member_of_version) go last, after read()'s own. - protocol-family-grouping.rst drops httpv1.HTTP and httpv2.HTTP from the #2529 pending list, now renamed; protocol-member-order.rst's _decode_text() example names HTTPv1.
|
Pushed
|
4f81180 to
519d9eb
Compare
|
NEEDS CHANGES at
|
- HTTP._dispatch_fields counts preface only when true, as its version check does, so HTTP(method=..., uri=..., preface=False) builds HTTP/1 again and HTTP(preface=False) picks HTTPv1; a new test pins both. A true preface beside HTTP/1 fields alone keeps the message "HTTP/1: connection preface is HTTP/2 only". - test_http_unit.py: base_read moves above the skip decorator, which guards HTTPUnitTests again. - protocol-family-grouping.rst's Dispatching Bases records that octets neither version takes are Raw with no error on the transport path, and raise ProtocolError through a direct HTTP(...), while octets HTTPv2's parser refuses after dispatch are Raw with the parser's error. - Rendered text cites #2524 rather than the pull request.
|
The fix round
Its local delta review (Sonnet) is GOOD TO GO. The push is held until the Actions queue is below 40 (it is at 68). The owner has ruled in session that pushes to open PRs go at < 40 and new PRs at < 20, so this goes out first. |
|
I cancelled every queued and pending run on |
|
GOOD TO GO at
|
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseconst— regenerates constant or registry tables, members keeping their numeric valuesDescription of your pull request and other information
Closes #2524, part of #2529. The final state is option 2 (owner on #2524); commits A and B predate that ruling.
HTTP.id()is('HTTP/1', 'HTTP/2'), whileHTTPv1.id()is('HTTP/1',)andHTTPv2.id()is('HTTP/2',).httpv1.HTTP/httpv2.HTTPbecomeHTTPv1/HTTPv2, with schema and data following. The old paths keep no re-export, andversionremoved:: 1.6.0marks them.HTTPv1orHTTPv2as IGMP's is.'HTTP/1'/'HTTP/2'select only their own version, and the family nameHTTPstill selects both.httptohttpv1/httpv2.== 'HTTP',== 'HTTPv1'and== 'HTTPv2'no longer match, and the old import paths are gone.info.preface, so that a dispatched opening rebuilds byte for byte.Rawwith noerror, where it was'HTTP: unknown version'(decision 1 below). A payload with a plausible HTTP/2 frame header thatHTTPv2refuses keeps the parser's own error, e.g.HTTP/2: [Type 2] invalid format.Rawwith noerror, where it carried'HTTP/2: connection preface with no frame'. The HTTP/2 data model holds a frame per layer, and a preface-only layer is feat(application): dissect every HTTP/2 frame in a segment, not only the first #2536's to add.