Skip to content

fix(http): give HTTP's version, data, start-line and settings errors the HTTP: prefix (#2298) - #2373

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2298-http-message-prefix
Oct 27, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2298-http-message-prefix

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — bug fix

Description

Closes #2298.

  • Problem: http.HTTP's version, data and version-guess errors, httpv1.HTTP._make_start_line's errors, and httpv2.HTTP._make_http_settings's rejection all broke the house <prefix>: <lowercase description>: … {value!r} form — missing or malformed prefixes, capitalised with a full stop, and some without the rejected values.
  • Fix: reword as HTTP: invalid version: 3, HTTP: invalid data: …, HTTP: unknown version, HTTP: invalid start line: … (naming the method and status it got), and HTTP/2: [Type 4] invalid settings: 42 (dropping the stray space before the colon and adding the rejected value).
  • Test: test_http_message_prefix_2298_unit pins each message, including the settings one; the existing pins in test_http_unit, test_http_guess_http2_1141_unit and test_http_from_data_1154_unit follow the new text.

@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 27, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.5 milestone Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: NEEDS CHANGES at 28ec3824c (Sonnet). Everything touched is correct and well pinned; one scope gap from the issue.

  1. Missed site: httpv2.HTTP._make_http_settings's else: branch still raises HTTP/2 : [Type 4] invalid settings (space before the colon, no value shown). fix(http): HTTP version, data and start-line messages lack the HTTP: prefix #2298 names this site explicitly. Fix + pin needed.
  2. Stale docstring tense: test_http_unit.py::test_guess_version_identifies_the_http2_connection_preface still says "would raise unknown HTTP version" — the old text, missed among the sibling updates.

Confirmed correct: every other touched site (version/data/version-guess in http.py, start-line in httpv1.py) matches the stated form exactly, live-triggered on both trees; no other missed site anywhere else in http.py/httpv1.py; tests pass, fail-without-fix gives 21 failures on origin/main. Fix in progress.

…the HTTP: prefix (#2298)

Problem: http.HTTP's version, data and version-guess errors,
httpv1.HTTP._make_start_line's errors, and httpv2.HTTP._make_http_settings's
rejection all broke the house "<prefix>: <lowercase description>: ...
{value!r}" form -- missing or malformed prefixes, capitalised with a full
stop, and some without the rejected values.

Fix: reword them as "HTTP: invalid version: 3", "HTTP: invalid data: ...",
"HTTP: unknown version", "HTTP: invalid start line: ..." (naming the method
and status it got), and "HTTP/2: [Type 4] invalid settings: 42" (dropping
the stray space before the colon and adding the rejected value).

Test: test_http_message_prefix_2298_unit pins each message, including the
settings one; the existing pins in test_http_unit, test_http_guess_http2_1141_unit
and test_http_from_data_1154_unit follow the new text.
@JarryShaw
JarryShaw force-pushed the fix/2298-http-message-prefix branch from 28ec382 to 336ea4a Compare October 27, 2026 07:35
@JarryShaw JarryShaw changed the title fix(http): give HTTP's version, data and start-line errors the HTTP: prefix (#2298) fix(http): give HTTP's version, data, start-line and settings errors the HTTP: prefix (#2298) Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Rebased and amended 28ec3824c → 336ea4aa1 (6 commits onto current origin/main, clean): added the missed httpv2._make_http_settings fix (HTTP/2: [Type 4] invalid settings: 42, dropping the stray space and adding the value), a pinning test (TestHTTPv2SettingsMessage), and fixed the stale docstring tense in test_http_unit.py. Title/body widened to mention the settings category. 7/7 message-prefix tests pass. Fresh review round dispatched.

@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) fix Pull requests that fix a defect (fix: subject prefix) labels Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 336ea4aa1 (Sonnet, round 2). Independently re-verified: HTTP/2: [Type 4] invalid settings: 42 triggers correctly live (9 more value types checked), fails without the fix (11 assertion sites), 8 mutation variants each caught by exactly the right subtest, docstring tense fix confirmed accurate, and a repo-wide AST walk of all 35 HTTP raise/warn sites found none missing the house form. Passes on Python 3.9-3.12 and 3.14. Added labels.

All findings across both rounds now addressed.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.58% (unit tier, Python 3.15, 336ea4aa1, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19601 881 2620 867 92.12%
pcapkit/corekit 2596 74 818 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 3029 23 1050 25 98.82%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17455 218 4598 185 98.15%
pcapkit/toolkit 914 36 334 10 95.51%
pcapkit/utilities 502 7 144 5 98.14%
pcapkit/vendor 4432 1988 1018 167 51.87%

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

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge.

Review: GOOD TO GO (Sonnet, round 2) at 336ea4aa1.
CI: Required checks passed, 0 failures (only the non-blocking experimental GraalPy leg still pending).
Mergeable, 0 unresolved threads.

@JarryShaw JarryShaw added the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 27, 2026
@JarryShaw
JarryShaw merged commit 028b841 into main Oct 27, 2026
64 checks passed
@JarryShaw
JarryShaw deleted the fix/2298-http-message-prefix branch October 27, 2026 15:13
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 27, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment) fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(http): HTTP version, data and start-line messages lack the HTTP: prefix

1 participant