ReviewOS

home-lang/home

Bun parity: preserve WebSocket custom handshake headers

#396
Closed chris opened this 10 days ago ·
10 days ago

Parent: #66 Predecessor: #395

Corpus position 4209/4708: js/web/websocket/websocket-custom-headers.test.ts.

The spawned Node header-echo fixture currently never delivers its IPC URL through the corpus runtime. Port it to the real in-memory ws topology and make handshake construction share one validated header path across virtual, Bun-listener, and raw clients.

Required contracts: custom Host and arbitrary headers; valid Sec-WebSocket-Key identity; invalid-key regeneration to a 16-byte base64 nonce; custom protocol precedence over the protocols array; canonical wire casing; Connection/Upgrade/version protection; valid special/empty values; and synchronous CRLF-injection rejection with actionable context. Preserve asynchronous IPC startup and child cleanup. Add a permanent exact-file regression. Acceptance: unchanged upstream file 10/10 with zero failed/todo/unsupported/allowed-empty.

10 days ago

Completed and pushed in c86d451 (feat(websocket): port custom handshake headers).

The unchanged position-4209 upstream file is 10/10, and positions 4202-4209 are 8 files / 54 passed / 0 failed / 0 todo / 0 unsupported / 0 allowed-empty.

The Node header-echo child is now a real in-memory ws server with asynchronous IPC and cleanup. One shared request-header path serves virtual, Bun-listener, and raw handshakes: it preserves custom Host/key/protocol/arbitrary headers, regenerates invalid nonces, honors custom protocol precedence, emits canonical WebSocket wire names, protects Connection/Upgrade/version, accepts valid special/empty values, and rejects CRLF injection synchronously. The permanent exact 10-case regression and all prior focused WebSocket guards pass. Parent: #66; predecessor: #395.

Sign in to comment on this issue.