Skip to content

[WebKit] WebSocket handshake request headers missing from HAR on macOS 26+ #42205

Description

Description

Once WebKit adopts NWLoader on macOS (microsoft/playwright-browsers#2470, issue #2464), the WebSocket handshake request reported for HAR recording and in the protocol is missing the Sec-WebSocket-Key, Connection and Upgrade headers on macOS 26+. The headers are still sent on the wire; only the reported request is incomplete. Response status and headers are unaffected, and macOS 15 is unaffected.

library/har-websocket.spec.ts "should include websocket handshake headers and status" is marked fixme for webkit on macOS 26+ (#42202) and should be re-enabled when this is fixed.

Cause

WebKit reports the handshake request from NSURLSessionWebSocketTask.currentRequest at send time. With NWLoader (the default network loader on macOS since 318278@main), CFNetwork on macOS 26+ no longer reflects the handshake headers it adds on the wire in currentRequest; on macOS 15, and with the legacy CFNetwork loader on all versions, it does. This is an Apple CFNetwork reporting gap — a candidate for a Feedback/radar.

Synthesizing the missing headers in the WebKit patch was considered and rejected: the real Sec-WebSocket-Key is generated inside CFNetwork after the reporting point, so the reported value would be fabricated.

Possible fixes

  • Apple fixes currentRequest under NWLoader (preferred; needs a Feedback report).
  • CFNetwork exposes the actual wire request another way (e.g. task transaction metrics carry the handshake request once available, but only after the connection is established — too late for webSocketWillSendHandshakeRequest ordering).

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions