mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-08-01 18:26:06 -04:00
The WebSocket opening handshake must carry the document's origin in an Origin header when initiated from a browser client (RFC 6455 §4.1), and origin-checking endpoints (CSRF protection on WS servers) reject upgrades that arrive without it. WebSocket.init already assembles extra upgrade headers (Sec-WebSocket-Protocol, Cookie) but never added Origin. Serialize the executing document's origin via URL.getOrigin next to the existing header setup — "null" for opaque origins (about:blank, data:), matching what Chrome sends. The TestWSServer captures the upgrade's Origin header and exposes it via a new get-origin command; an origin_on_upgrade fixture in websocket.html asserts the served page's origin arrives on the upgrade. Closes #2709
14 KiB
14 KiB