1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

raw-proxy: don't defer to raw-skt if we wanted raw-proxy

At some point raw-skt became the default that overrode
the raw-proxy binding request.  Don't do that if we can
see we specifically wanted raw-proxy.
This commit is contained in:
Andy Green 2019-09-10 18:25:53 +01:00
parent 3452980391
commit 7528491505
4 changed files with 12 additions and 5 deletions

View file

@ -584,7 +584,7 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
case LWS_CALLBACK_CLOSED_CLIENT_HTTP:
if (!lws_get_parent(wsi))
break;
lwsl_err("%s: LWS_CALLBACK_CLOSED_CLIENT_HTTP\n", __func__);
// lwsl_err("%s: LWS_CALLBACK_CLOSED_CLIENT_HTTP\n", __func__);
lws_set_timeout(lws_get_parent(wsi), LWS_TO_KILL_ASYNC,
PENDING_TIMEOUT_KILLED_BY_PROXY_CLIENT_CLOSE);
break;

View file

@ -164,8 +164,9 @@ rops_client_bind_raw_proxy(struct lws *wsi,
/* we are a fallback if nothing else matched */
// lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
// &role_ops_raw_proxy);
if (i->local_protocol_name && !strcmp(i->local_protocol_name, "raw-proxy"))
lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
&role_ops_raw_proxy);
return 0;
}

View file

@ -206,7 +206,8 @@ rops_client_bind_raw_skt(struct lws *wsi,
/* we are a fallback if nothing else matched */
lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
if (!i->local_protocol_name || strcmp(i->local_protocol_name, "raw-proxy"))
lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
&role_ops_raw_skt);
return 1; /* matched */

View file

@ -252,10 +252,12 @@ bad_onward:
break;
case LWS_CALLBACK_RAW_PROXY_CLI_ADOPT:
lwsl_debug("LWS_CALLBACK_RAW_CLI_ADOPT: pss %p\n", pss);
lwsl_debug("%s: %p: LWS_CALLBACK_RAW_CLI_ADOPT: pss %p\n", __func__, wsi, pss);
if (conn || !pss)
break;
conn = pss->conn = lws_get_opaque_user_data(wsi);
if (!conn)
break;
conn->established[ONW] = 1;
/* they start enabled */
conn->rx_enabled[ACC] = 1;
@ -445,6 +447,9 @@ bad_onward:
return -1;
}
if (!len)
return 0;
pkt.payload = malloc(len);
if (!pkt.payload) {
lwsl_notice("OOM: dropping\n");