ReviewOS

home-lang/home

Bun parity: delimit repeated Cookie headers correctly

#350
Closed chris opened this 24 days ago · 1 comment
24 days ago

Upstream coverage

  • js/web/fetch/cookies.test.ts (corpus position 4122)

Current gap

Appending multiple Cookie header values currently joins them with a comma. Cookie request fields must be combined with ; , so the first failing assertion receives FOO=... , BAR=... instead of Bun's semicolon-delimited value.

Required parity

  • combine repeated Cookie request values with ; rather than ,
  • preserve ordinary Fetch Headers combination semantics for non-cookie fields
  • keep Set-Cookie response values independently enumerable where required
  • maintain original header-name behavior and Node/Fetch bridge interoperability
  • surface invalid cookie/header operations with stable structured Home errors and useful stacks
  • add a focused regression and pin the upstream file in the permanent web queue

This is the next ordered step after #349.

24 days ago

Implemented and pushed to main in 4b21573607611bb1aa61c82631645f8da2f26580.

  • Repeated Cookie values now serialize with ; while other repeated headers retain comma joining.
  • Cookie validation failures preserve the Bun-compatible TypeError message and add ERR_INVALID_HTTP_HEADER, headers.cookie.validate, the offending header/value, a cause, and a composed stack.
  • Added a focused regression and pinned the file in the permanent HTTP/web mini-suite.

Verification:

  • js/web/fetch/cookies.test.ts: 3 passed, 1 upstream todo, 0 failed, 0 unsupported
  • focused cookie regression: passed
  • permanent HTTP/web tail queue: passed
  • zig build --cache-dir /private/tmp/home-zig-abi-cache: passed

Sign in to comment on this issue.