Skip to content

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

Closed

Description

@JarryShaw

Describe the bug
Most HTTP messages read HTTP: invalid format or HTTP/2: [Type N] …, but these break the <prefix>: <lowercase description>: … {value!r} form (#2232, #2257):

  • http.HTTP.read / make: invalid HTTP version: 3. _make_data: invalid HTTP data: Raw. _guess_version: unknown HTTP version.
  • httpv1.HTTP._make_start_line: HTTP request must have URI. and HTTP packet must be either request or response. These are capitalised, end with a full stop and don't name the offending argument.
  • httpv2.HTTP._make_http_settings: HTTP/2 : [Type 4] invalid settings. It has a space before the colon, and the rejected value isn't shown.

Reproduction (main 9d504ead5)

>>> HTTP.make(HTTP.__new__(HTTP), version=3)
ProtocolError: invalid HTTP version: 3
>>> H2.__new__(H2)._make_http_settings(settings=42)
ProtocolError: HTTP/2 : [Type 4] invalid settings

Expected behavior
For example HTTP: invalid version: 3, HTTP: unknown version, HTTP: invalid start line: a request needs a URI, HTTP/2: [Type 4] invalid settings: 42. Pins to update: test_http_unit asserts str(ctx.exception) == 'unknown HTTP version' and lists it in a table of expected messages, and test_http_guess_http2_1141_unit / test_http_from_data_1154_unit match unknown HTTP version / invalid HTTP data by regex.

System information
Linux, CPython 3.14.9, checkout main 9d504ead5.

Activity

  1. added this to the PyPCAPKit v1.5 milestone on Oct 26, 2026
  2. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    on Oct 26, 2026
  3. moved this to Pending in PyPCAPKiton Oct 26, 2026
  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 26, 2026
  5. moved this from Pending to WIP in PyPCAPKiton Oct 26, 2026
  6. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions