Streaming fails to recognise "Upgrade: WebSocket" case insensitive
nickandrew opened this issue · comments
Connecting to wss://stream-channel.app.net/stream/user
the success of the connection depends on the exact case in the Upgrade:
header.
Fail case:
GET /stream/user?access_token=WHATEVER HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: stream-channel.app.net
Authorization: Bearer WHATEVER
Origin: https://stream-channel.app.net
Sec-WebSocket-Key: UbkaXXkVWOn33stTE1Ua8g==
Sec-WebSocket-Version: 13
Returns:
HTTP/1.1 200 OK
Server: nginx/1.6.0
Date: Sun, 21 Dec 2014 16:26:13 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
[etc]
Changing only to Upgrade: websocket
results in success:
HTTP/1.1 101 Switching Protocols
Server: nginx/1.6.0
Date: Sun, 21 Dec 2014 16:28:29 GMT
Connection: upgrade
Upgrade: websocket
Sec-WebSocket-Accept: TWqVfqfvXuSuwtfaeIFrPh/+F/g=
[etc]
The perl library I'm using is Protocol::WebSocket and it has the mixed-case string hardcoded. RFC6455 section 4.2.1 (which I believe is the relevant RFC) says the value must be case-insensitive.