WebSocket should fail when client specifies subprotocols and server replies with none
Categories
(Core :: Networking: WebSockets, defect, P3)
Tracking
()
People
(Reporter: contact, Unassigned)
Details
(Whiteboard: [necko-triaged])
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Steps to reproduce:
Try the following with a WebSocket server which doesn't care about subprotocols:
let ws = new WebSocket("wss://example.org", ["invalid-subprotocol"]);
Actual results:
The connection succeeds.
Expected results:
The connection should fail, because the server will reply with an empty subprotocol.
https://bugzilla.mozilla.org/show_bug.cgi?id=711886 fixes a similar bug (server replies with a different subprotocol) but fails to handle the case where the returned subprotocol is empty.
The spec says:
If protocols is not the empty list and extracting header list values given
Sec-WebSocket-Protocoland response’s header list results in null, failure, or the empty byte sequence, then fail the WebSocket connection.
Ref https://fetch.spec.whatwg.org/#websocket-opening-handshake
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Networking: WebSockets' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Updated•4 years ago
|
Description
•