ReviewOS

home-lang/home

Bun parity: preserve compressed request bodies over HTTP/2

#355
Closed chris opened this 11 days ago ·
11 days ago

Corpus location

  • Position: 4133
  • File: js/web/fetch/fetch-http2-client.test.ts
  • First observed failure: compress: gzip request body over h2 — small (shared-buffer fast path) 32768
  • Symptom: the HTTP/2 server receives bytes that zlib.gunzipSync() rejects with incorrect header check, so the compressed request body is not preserved end to end.

Required parity

  • Preserve gzip-compressed request bytes across the HTTP/2 shared-buffer fast path (32 KiB).
  • Preserve gzip-compressed request bytes across the streaming/spill path (600 KiB).
  • Forward Content-Encoding: gzip and the compressed Content-Length, not the original body length.
  • Ensure the server can decompress the body byte-for-byte back to the original payload.
  • Keep HTTP/1.1 request compression and HTTP/2 response decompression behavior green.
  • Surface transport/compression failures through structured errors with operation, codec, phase, cause, and composed stack context.

Completion gate

  • Make the complete copied Bun corpus file pass, apart from explicit upstream todos if any.
  • Add focused regression coverage and pin the file in the permanent HTTP/web mini-suite.
  • Keep copied-corpus accounting and the project build green.

Parent tracker: #66 Predecessor: #354

11 days ago

Completed in 0239931e4 (fix(fetch): preserve compressed HTTP/2 bodies).

The shared fetch pipeline is now the single owner of request compression. The HTTP/2 adapter no longer gzip-compresses an already-compressed body, so both the 32 KiB shared-buffer path and 600 KiB streaming/spill path preserve the compressed bytes, Content-Encoding, compressed Content-Length, and byte-exact decompressed payload.

HTTP/2 compression transport failures now carry structured diagnostics: ERR_FETCH_COMPRESSION_TRANSPORT, operation=fetch.request.compress.transport, protocol, codec, phase, cause, and a composed stack.

Verification:

  • js/web/fetch/fetch-http2-client.test.ts: 60 passed, 0 failed, 0 todo, 0 unsupported.
  • js/web/fetch/fetch-http2-leak.test.ts: 7 passed, 0 failed, 0 todo, 0 unsupported.
  • Existing focused HTTP/2 client/adversarial/lifetime matrix: passed.
  • zig build --cache-dir /private/tmp/home-zig-abi-cache: passed.

The verified frontier now runs through position 4134. Follow-up HTTP/3 streaming event-loop work is tracked in #356.

Sign in to comment on this issue.