appdotnet / api-spec

App.net API Documentation is on the web at https://developers.app.net. Source for these docs is in the new-docs branch here. Please use the issue tracker and submit pull requests! Help us build the real-time social service where users and developers come first, not advertisers.

Home Page:https://developers.app.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.