-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Currently the accept() method fails when receiving WebSocket connections from Firefox because Firefox sends the :
Connection: keep-alive, Upgrade
while webkit (and others) use
Connection: Upgrade
Thus, when using Firefox (which is using a poco compatible WEBSOCKET_VERSION === 13), the connection fails.
Currently my work-around is to do a more thorough header check and if the Connection headers contains the Upgrade token (in any position), I reset the header like this request.set("Connection","Upgrade") before constructing the websocket like this Websocket ws(request,response);. When I do this, I am able to communicate successfully with the same browser Firefox using Poco's WebSocket Server implementation.
Other WebSocket server implementations have run into this same problem (a quick google search will locate a few other github issues that were resolved). A justification for the Firefox multi-token Connection header was given here - a quick summary:
RFC 2068 section 14.10 is quite clear that it's permissible to send multiple comma-delineated tokens in the Connection header. And the websocket spec--RFC 6455--says that "The request MUST contain a |Connection| header field whose value MUST include the "Upgrade" token" (section 4.1): note the use of "include", not "be equal to". But twimbow's server is simply failing to reply at all to our HTTP handshake, and we eventually time out the connection. (If I change the Connection header to just "Upgrade", we connect fine)...
Anyway, my workaround is fine for the moment, but perhaps a Poco could drop the single-token Connection header requirement in a future version?
Thanks!