Open
Description
From the websockets RFC:
- An
Upgrade
header field containing the value "websocket",
treated as an ASCII case-insensitive value.- A
Connection
header field that includes the token "Upgrade",
treated as an ASCII case-insensitive value.- A
Sec-WebSocket-Key
header field with a base64-encoded (see
Section 4 of [RFC4648]) value that, when decoded, is 16 bytes in
length.- A
Sec-WebSocket-Version
header field, with a value of 13.
Currently, we look for an Upgrade
header with the case-sensitive value "websocket".
If some but not all of the websockets properties hold, we should response with an appropriate error. Just not identifying non-complying requests as websockets handshakes should work out ok, but if it has any of the headers with "websocket" in the name or value (but does not follow all four), then I think we should response with an error at that point.
The Sec-Websocket-Key
property can be determined by counting the total number of characters and the number of =
-signs at the end of the value. 16 = 22 + 2=
. (Meaning you don't actually have to decode it to figure out whether the length property holds.)