You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
httpv1: a message with no header fields fails to parse #1041
pcapkit.protocols.application.httpv1.HTTP rejects every HTTP/1 message that has no header fields, even though RFC 9112 allows zero (*( field-line CRLF )). Measured on main:
b'GET / HTTP/1.0\r\n\r\n' -> ProtocolError: HTTP: invalid format (httpv1.py:385)
b'HTTP/1.0 200 OK\r\n\r\nbody' -> ProtocolError: HTTP: invalid format (httpv1.py:385)
b'GET / HTTP/1.1\r\nHost: x\r\n\r\n' -> OK
Cause:_read_http_header (httpv1.py:381-385) does header.split(b'\r\n', 1) and treats a missing CRLF as malformed. A message without headers has a header block that is only the start line, so the two-way unpacking fails.
Round trip is broken too.HTTP.make(method='GET', uri='/', http_version='1.1') produces b'GET / HTTP/1.1\r\n\r\n', which the reader then rejects. So HTTPv1(method='GET', uri='/', http_version='1.1') raises.
Fix: treat a header block with no CRLF as a start line with zero fields. Keep the HTTP/2-preface rejection that the comment above the split depends on. Add tests for a headerless request, a headerless response with a body, and the make→read round trip.
Blocked on #1039, an open docstring-only PR (#719 sweep) that edits httpv1.py. Starts once #1039 merges or closes. Found while reviewing #1039.
Activity
JarryShaw commentedon Oct 5, 2026
Unblocked: #1039 merged. A worker is on the fix now.
fix(httpv1): accept HTTP/1 messages with no header fields (#1041)
fix(httpv1): accept HTTP/1 messages with no header fields (#1041)
fix(httpv1): accept HTTP/1 messages with no header fields (#1041) (#1049