[Libwebsockets] HS: WS upgrade response not 101

Andy Green andy at warmcat.com
Fri Apr 5 04:33:35 CEST 2019



On 05/04/2019 09:59, AL wrote:
> It's a prebuilt package in cocos2dx. Their change log on the last 
> libwebsocket is May 2016
> 
> "Upgraded to latest libwebsocket"
> 
> No mention on versioning. Libwebsocket change log also don't have date, 
> so I don't really know which is the version.
> 
> I don't think libwebsocket is broken, cos it does work with some other 
> websocket servers I tested. It's probably STA Csharp websocket not 
> updated , and I like to try fix it if I can know what libwebsocket has 
> upgraded something in handshake format. I'm not familiar with 

Dump the headers... from the wire if it's not tls...

-Andy

> libwebsocket codebase, this is my first time looking at it.
> 
> Robin
> 
> Andy Green wrote on 05-Apr-19 8:48 AM:
>>
>>
>> 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".
>>
>> -Andy
>>
>>> 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