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

ws proxy: ensure upgrade request url starts with slash

In the case rpath is set to //, any urlargs will be added
right at the start.  Add a check to keep the initial / if so.

https://github.com/warmcat/libwebsockets/issues/1733
This commit is contained in:
Andy Green 2019-10-26 05:31:01 +01:00
parent 7d8036b72e
commit 186888ed39

View file

@ -1106,7 +1106,12 @@ lws_http_proxy_start(struct lws *wsi, const struct lws_http_mount *hit,
lws_clean_url(rpath);
na = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_URI_ARGS);
if (na) {
char *p = rpath + n;
char *p;
if (!n) /* don't start with the ?... use the first / if so */
n++;
p = rpath + n;
if (na >= (int)sizeof(rpath) - n - 2) {
lwsl_info("%s: query string %d longer "