ReviewOS

zig-utils/zig-js

Implement versioned UWS and H3 FetchHeaders bridge

#381
Closed chris opened this 9 days ago ·
9 days ago

Parent: #377

Implement WebCore__FetchHeaders__createFromUWS, WebCore__FetchHeaders__createFromH3, and WebCore__FetchHeaders__toUWSResponse for the pinned Bun/Home consumer revisions.

These parameters are opaque C++ objects, not stable data layouts. Define a revisioned C adapter contract that invokes the real uWebSockets/HTTP3 iteration and response methods instead of reinterpreting their object layouts in Zig.

Acceptance:

  • Request adapters preserve raw order, known/uncommon names, duplicates, pseudo-header rules, and copied ownership.
  • Response adapters preserve repeated Set-Cookie rows; write names/values exactly; maintain Content-Length, Date, and Transfer-Encoding state/mark behavior for TCP/SSL and the HTTP/3 restrictions.
  • Pin response-kind values and every bridge callback/layout to the supported revisions.
  • Null, unknown-kind, unsupported-version, and callback failure paths are explicit and safe.
  • Add exact consumer-side bridge fixtures plus Debug and ReleaseSafe integration evidence, inventories/docs/CI, and update parents.

Children

  • 382 — request visitor bridge
  • 383 — response writer bridge
9 days ago

Pinned implementation audit at Bun 4982b91e: src/jsc/bindings/bindings.cpp copies/iterates uWS::HttpRequest and calls Http3Request::forEachHeader; src/jsc/bindings/NodeHTTP.cpp calls TCP/SSL/H3 writeHeader, marks Content-Length, and updates Date/Transfer-Encoding response state. None of that behavior is encoded by the exported *anyopaque signatures. The implementation must therefore expose revisioned consumer-side callbacks/bridge functions; direct Zig casts to guessed C++ layouts are explicitly out of scope.

9 days ago

Split by data flow: /zig-utils/zig-js/issues/382 covers the two request importers; /zig-utils/zig-js/issues/383 covers the response writer and state flags. Starting with the request bridge.

9 days ago

Request child #382 is complete in a9e909b4 + 727a1651. Only response writer child #383 remains.

9 days ago

Both children are complete: request bridge #382 and response bridge #383. All three opaque UWS/H3 FetchHeaders exports now use the exact installed v1 consumer contract.

Sign in to comment on this issue.