[Libwebsockets] HS: WS upgrade response not 101

Andy Green andy at warmcat.com
Sun Apr 7 07:38:28 CEST 2019



On April 7, 2019 1:19:55 PM GMT+08:00, AL <al at cyberversion.com> wrote:
>Ok, I changed it to this, same error
>
>char urlPath[300];
>
>urlPath[0] = '/';
>urlPath[1] = '\0';
>
>clientConnectInfo.path = urlPath; // Set the info's path to the fixed
>up 
>url path
>
>
>
>
>Wireshark returns now with strange symbols at the front.

You changed your code (because that's a chunk of your code...) and something broke... what do you expect me and the >200 other people on this list to do about it?

-Andy

>
>
>²
>máE0o
>@£À¨cÀ¨ì×0#) 0u    =&
>PïDGET / HTTP/1.1
>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
>
>
>Andy Green wrote on 06-Apr-19 5:22 PM:
>>
>>
>> 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