Skip to content

Fix edge-http framing of HEAD, 1xx, 204 and 304 responses - #110

Closed
zolstein wants to merge 1 commit into
sysgrok:masterfrom
zolstein:edge-http-no-body-responses
Closed

zolstein wants to merge 1 commit into
sysgrok:masterfrom
zolstein:edge-http-no-body-responses

Conversation

@zolstein

@zolstein zolstein commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

These responses never have a body, but edge-http chose their framing from the headers alone. A HEAD or 304 response carrying the GET's Content-Length failed with IncompleteBody and closed the connection, and a HEAD or 204 response with no body header was sent chunked, which the client read as the start of the next response.

The server now sends these responses with no body and adds no Content-Length or Transfer-Encoding. A non-empty body write fails with TooLongBody. A 1xx or 204 response with Transfer-Encoding or a non-zero Content-Length is rejected, and a Content-Length: 0 is dropped.

The client now reads these responses as bodiless too, and rejects interim 1xx responses (other than 101), which it does not support yet.

ws::upgrade_response_headers no longer returns Content-Length: 0, which is not allowed on a 101; UPGRADE_RESPONSE_HEADERS_LEN is now 3.

These responses never have a body, but edge-http chose their framing
from the headers alone. A HEAD or 304 response carrying the GET's
`Content-Length` failed with `IncompleteBody` and closed the connection.
A HEAD or 204 response with no body header was sent chunked, which the
client read as the start of the next response.

The server now sends these responses with no body and adds no
`Content-Length` or `Transfer-Encoding`. A non-empty body write fails
with `TooLongBody`. A 1xx or 204 response with `Transfer-Encoding` or a
non-zero `Content-Length` is rejected, and a `Content-Length: 0` header
is dropped.

The client now reads these responses as bodiless too, and rejects
interim 1xx responses (other than 101), which it does not support.

`ws::upgrade_response_headers` no longer returns `Content-Length: 0`,
which is not allowed on a 101; `UPGRADE_RESPONSE_HEADERS_LEN` is now 3.
@ivmarkov

ivmarkov commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks!
Look at #111 - this is your work (with attribution kept), but with a merge conflict resolved, and some extra work on the 1xx headers on top.

@ivmarkov ivmarkov closed this Nov 9, 2026
@zolstein
zolstein deleted the edge-http-no-body-responses branch November 9, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants