MostAwesomeDude / txWS

Twisted WebSockets
Other
94 stars 29 forks source link

Match for "Connection: Upgrade" HTTP header should be case-insensitive on the value #17

Closed nilstoedtmann closed 11 years ago

nilstoedtmann commented 11 years ago

According to the WebSocket standard (http://tools.ietf.org/html/rfc6455#section-4.1, page 18), matching the value(s) of the "Connection:" header for "Upgrade" should be done case-insensitive:

If the response lacks a |Connection| header field or the |Connection| header field doesn't contain a token that is an ASCII case-insensitive match for the value "Upgrade", the client MUST Fail the WebSocket Connection.

But it looks like txWS does a case-sensitive string comparison in line 110: https://github.com/MostAwesomeDude/txWS/blob/master/txws.py#L110


BTW I found this when i tried to proxy an example txWS echo server (http://ajf.me/websocket/) with nginx. But nginx' WebSocket documentation (http://nginx.org/en/docs/http/websocket.html) uses lower-case "upgrade", and i had to upper-case it to get txWS to work

BTW txWS is not the only WS lib making this mistake, see e.g. https://github.com/faye/faye-websocket-ruby/issues/15 :-)