Skip to content

httpv1: from_data fails on a message with an empty body #1050

Closed

Description

@JarryShaw

HTTPv1 cannot rebuild a message whose body is empty. Measured on main (487306631) and on #1049's head:

raw = b'GET / HTTP/1.1\r\nHost: a\r\n\r\n'
HTTP.from_data(HTTP(io.BytesIO(raw), len(raw)).info)
-> TypeError: can't concat NoneType to bytes   (httpv1.py:320 on #1049, :312 on main)

Cause: read stores body=... or None (httpv1.py:237 on #1049). _make_data passes that through (:355), so make, which declares body: bytes = b'', receives an explicit None and concatenates it. Responses with a non-empty body round-trip fine.

Fix: make make (or _make_data) treat body=None as b''. Add a from_data round-trip test for an empty-bodied request with headers, a headerless request, and an empty-bodied response.

Blocked on #1049, which edits httpv1.py. Work starts once #1049 merges or closes. Found while reviewing #1049.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 5, 2026
  2. JarryShaw commented on Oct 5, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1049 merged. A worker is on the fix now.

  3. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 5, 2026
  4. added this to the 1.5 milestone on Oct 6, 2026
  5. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 6, 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

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions