Skip to content
Snippets Groups Projects
Commit 0850231a authored by kzhdev's avatar kzhdev Committed by Andy Green
Browse files

ws: client: if server sends no subprotocol prefer any existing protocol

parent c40394f9
Branches
Tags v0.2.8
No related merge requests found
...@@ -305,9 +305,17 @@ bad_conn_format: ...@@ -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: ...@@ -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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment