[Libwebsockets] HS: WS upgrade response not 101

Andy Green andy at warmcat.com
Fri Apr 5 02:48:44 CEST 2019

On 05/04/2019 08:43, AL wrote:
> Thanks Andy,
> The server log is "Handshake failed due to an unexpected packet format", 
> which is not very helpful. The server is pretty old and not updated 
> often so I would think libwebsocket has changed the packet format to a 
> newer standard or something. So what did libwebsocket changed in 
> handshake format?

Eh... that went from "you would think" to "what did"... get some 
evidence about what you have experienced, and then we can discuss what 
you found.  Ie, as suggested dump the request headers.

You don't mention the starting version even, just that the version with 
the behaviour is 2.4.2.  So no point asking me "what changed".


> Robin
> Andy Green wrote on 05-Apr-19 12:59 AM:
>> On April 4, 2019 7:20:17 PM GMT+08:00, AL <al at cyberversion.com> wrote:
>>> Hi,
>>> I'm using libwebsocket through a third party framework (cocos2dx
>>> 3.17.1). When they upgraded to libwebsocket 2.4.2, the client connected
>>> to my websocket server broke with
>>>   HS: WS upgrade response not 101
>>> error. I tested with libwebsocket directly, it has the same error. The
>>> previous libwebsocket cocos2dx uses can work fine, and I can't find
>>> much
>>> of this error. What could be wrong?
>> The error is pretty clear... the server refused the upgrade.
>>> The websocket server is Websocket-Csharp
>>> https://github.com/sta/websocket-sharp
>> The server can refuse the ws upgrade for any reason, it can have any 
>> policy about rejecting connections, or bugs or quirks in exactly what 
>> it would accept.  Or of course lws may have broken something.
>> You need to debug this starting from verbose server logs and / or 
>> dumping the request / response headers.
>> -Andy
>>> -- 
>>> Robin
>>> _______________________________________________
>>> Libwebsockets mailing list
>>> Libwebsockets at ml.libwebsockets.org
>>> https://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list