Skip to content

fix(http bridge): let undici own Content-Length for buffered request bodies - #141

Open
epslkslsksndnsjs-lab wants to merge 1 commit into
earendil-works:mainfrom
epslkslsksndnsjs-lab:fix/buffered-request-content-length
Open

fix(http bridge): let undici own Content-Length for buffered request bodies#141
epslkslsksndnsjs-lab wants to merge 1 commit into
earendil-works:mainfrom
epslkslsksndnsjs-lab:fix/buffered-request-content-length

Conversation

@epslkslsksndnsjs-lab

Copy link
Copy Markdown

Resolves #134.

On Node.js >= 24.17, undici rejects a manually supplied Content-Length header for a buffered request body (invalid content-length header). The bridge forwards buffered request bodies with a manually set Content-Length, so undici throws and the bridge returns a 502 for buffered request bodies.

Changes in host/src/qemu/http.ts:

  • On the buffered request paths (content-length-complete and chunked-complete), stop setting Content-Length manually; undici computes an accurate Content-Length from the buffered body automatically.
  • The incoming Content-Length is still normalized during request parsing.

Note: I could not run the full gondolin test suite here (needs pnpm + QEMU). The change is minimal and scoped to the two buffered-body completion paths; please verify on CI across the supported Node versions (esp. >= 24.17).

…bodies

Resolves earendil-works#134. On Node.js >= 24.17, undici rejects a manually supplied
Content-Length header for a buffered request body (invalid content-length
header), which the bridge surfaced as a 502 for buffered request bodies.

The bridge no longer sets Content-Length manually on the buffered request
paths (content-length-complete and chunked-complete); undici computes an
accurate Content-Length from the buffered body automatically. The parsed
Content-Length is still normalized during request parsing.
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.

Bug: QEMU HTTP bridge returns 502 for buffered request bodies on Node.js >= 24.17 (invalid content-length header)

1 participant