ReviewOS

zig-utils/zig-js

Implement exact PicoHeaders FetchHeaders adapter

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

Parent: #377

Implement WebCore__FetchHeaders__createFromPicoHeaders_ against Bun revision 4982b91e3702094330f3be3883354c52b8c01323.

Pinned layout:

typedef struct { const unsigned char *ptr; size_t len; } ZigSliceString;
typedef struct { ZigSliceString name; ZigSliceString value; } PicoHTTPHeader;
typedef struct { const PicoHTTPHeader *ptr; size_t len; } PicoHTTPHeaders;

Acceptance:

  • Copy all accepted name/value bytes into the native FetchHeaders record; never retain foreign spans.
  • Match the pinned adapter behavior for empty rows, known/uncommon names, duplicates, and Set-Cookie rows.
  • Reject null or structurally invalid spans safely without dereferencing them.
  • Add an exact-layout compile-link-runtime fixture in Debug and ReleaseSafe, refresh inventories/docs/CI, and update parents.
9 days ago

Implemented and pushed in 91c91b3f (adapter + inventories) and 42bcd356 (fixtures + docs).

Pinned behavior now covered:

  • exact nested {ptr,len} ABI sizes and offsets from Bun 4982b91e
  • all foreign name/value bytes are copied before return
  • known duplicates combine; Cookie uses ; ; Set-Cookie remains multi-row
  • uncommon duplicates replace the value while retaining the first spelling
  • raw parsed values are not WebIDL-trimmed; empty name/value rows are skipped
  • null, misaligned, null nested spans, oversized spans, and address overflow return an empty handle before mutation

Evidence:

  • FetchHeaders units: 3/3 Debug
  • Bun exact boundary: 22/22 Debug and ReleaseSafe
  • Home exact private fixture: 385/385 Debug and ReleaseSafe
  • inventories: Home 398/471, Bun 390/461, zero unclassified

Sign in to comment on this issue.