Repository navigation
refactor(application)!: dispatch HTTP to HTTPv1/HTTPv2 under the RFC names (#2524) - #2544
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: |
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
|
…ons into 1.6.0 (#2449) - Breaking: HTTP dispatches to HTTPv1/HTTPv2 on read, make and from_data, and so does a transport payload, whose data key moves from http to httpv1/httpv2; the members and their schema and data classes are renamed from httpv1.HTTP/httpv2.HTTP with no re-export; id() takes the RFC names; unrecognised transport payloads are Raw with no error (#2544). - Changed: conventions record the dispatching base (#2544) and the case-fold exceptions (#2583); a project test guards every shipped module's documentation entry (#2584). Summary names the HTTP change. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
…s into 1.6.0 (#2449) - Folded into the TLS/DTLS entry: DTLSContext resolves a unified-header record's connection ID as a tls12_cid one's, an ID NewConnectionId issues coming only from the caller; every unified-header record's info carries cid, None when C is clear, the one-data-model ruling on #2625; make() takes cid (#2643). The entry drops the stale "stays Raw" for those records. - 1.5.0's httpv1.HTTP and httpv2.HTTP roles point at HTTPv1 and HTTPv2, renamed by #2544, so the nitpicky build no longer warns on them; 1.5.0's text unchanged. - No entry for the test-only #2644. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
…les (#2628) (#2651) - `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.
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.