mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 09:35:59 -04:00
The WebSocket upgrade handshake is an HTTP/1.1 request (RFC 6455 §4.1) and follows ordinary cookie semantics — RFC 6265 §5.4 attaches matching cookies to "any HTTP request" by domain/path. Without this, cookie- authenticated WebSocket endpoints (anything session-gated, e.g. Phoenix LiveView) reject the upgrade because their auth cookie never arrives. Read matching cookies from the session jar with the same opts shape HTTPDocument uses (`is_http: true, is_navigation: false`), and add a `Cookie:` request header on the upgrade if any apply. The TestWSServer captures the upgrade's Cookie header and exposes it to fixtures via a new `get-cookie` command. A `cookies_on_upgrade` fixture in websocket.html sets `document.cookie` then asserts the server received it on the upgrade.
13 KiB
13 KiB