mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
ws: client: if server sends no subprotocol prefer any existing protocol
This commit is contained in:
parent
c40394f968
commit
0850231a09
1 changed files with 11 additions and 1 deletions
|
@ -305,9 +305,17 @@ bad_conn_format:
|
||||||
if (!len) {
|
if (!len) {
|
||||||
lwsl_info("%s: WSI_TOKEN_PROTOCOL is null\n", __func__);
|
lwsl_info("%s: WSI_TOKEN_PROTOCOL is null\n", __func__);
|
||||||
/*
|
/*
|
||||||
* no protocol name to work from,
|
* no protocol name to work from, if we don't already have one
|
||||||
* default to first protocol
|
* default to first protocol
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (wsi->protocol) {
|
||||||
|
p = (char *)wsi->protocol->name;
|
||||||
|
goto identify_protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no choice but to use the default protocol */
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
wsi->protocol = &wsi->vhost->protocols[0];
|
wsi->protocol = &wsi->vhost->protocols[0];
|
||||||
goto check_extensions;
|
goto check_extensions;
|
||||||
|
@ -334,6 +342,8 @@ bad_conn_format:
|
||||||
goto bail2;
|
goto bail2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
identify_protocol:
|
||||||
|
|
||||||
#if defined(LWS_WITH_HTTP_PROXY)
|
#if defined(LWS_WITH_HTTP_PROXY)
|
||||||
lws_strncpy(wsi->ws->actual_protocol, p,
|
lws_strncpy(wsi->ws->actual_protocol, p,
|
||||||
sizeof(wsi->ws->actual_protocol));
|
sizeof(wsi->ws->actual_protocol));
|
||||||
|
|
Loading…
Add table
Reference in a new issue