[Libwebsockets] HS: WS upgrade response not 101

Andy Green andy at warmcat.com
Sat Apr 6 11:22:39 CEST 2019



On 06/04/2019 17:00, AL wrote:
> That's strange indeed. I did another capture, this time it showed 
> correctly.
> 
> GET // HTTP/1.1

This looks like something that might trip it up.

Can you check the .path member of the client connection info struct and 
maybe strip a / somewhere?

-Andy

> Pragma: no-cache
> Cache-Control: no-cache
> Host: 192.168.1.236
> Origin: http://192.168.1.236
> Upgrade: websocket
> Connection: Upgrade
> Sec-WebSocket-Key: KSO+hOFs1q5SkEnx8bvp6w==
> Sec-WebSocket-Protocol: test-protocol
> Sec-WebSocket-Version: 13
> 
> 
> HTTP/1.1 400 Bad Request
> Server: websocket-sharp/1.0
> Connection: close
> 
> 
> 
> 
> 
> Andy Green wrote on 05-Apr-19 9:34 PM:
>>
>>
>> On 05/04/2019 20:06, AL wrote:
>>> Noe, it did not work. This is the setup.
>>
>>>      clientConnectInfo.ssl_connection |= LCCSCF_PIPELINE;
>>>
>>>      printf("Connecting to %s://%s:%d%s \n\n", urlProtocol, 
>>> clientConnectInfo.address, clientConnectInfo.port, urlPath);
>>>
>>>      // Connect with the client info
>>>      lws_client_connect_via_info(&clientConnectInfo);
>>
>> Something is fishy somewhere... 2.4.2 you mentioned (actually, 
>> v2.4-stable referenced here) doesn't have the code to produce your 
>> problem
>>
>> https://libwebsockets.org/git/libwebsockets/tree/lib/client/client.c?h=v2.4-stable#n1227 
>>
>>
>>         if (wsi->do_ws) {
>>                 p += sprintf(p, "Upgrade: websocket\x0d\x0a"
>>                                 "Connection: Upgrade\x0d\x0a"
>>                                 "Sec-WebSocket-Key: ");
>>
>> The advice I gave...
>>
>>> Andy Green wrote on 05-Apr-19 6:48 PM:
>>>> On 05/04/2019 17:39, AL wrote:
>>>>
>>>> I guess it finds this confusing.
>>>>
>>>>> Connection: close, Upgrade
>>>>
>>>> If you set, on your client connection info
>>>>
>>>>     i->ssl_connection |= LCCSCF_PIPELINE;
>>>>
>>>> it should remove the "close," part it doesn't like.
>>
>> ... is correct for master, which can produce that Connection string.
>>
>> -Andy
>>
>>>> -Andy
>>>
> 


More information about the Libwebsockets mailing list