diff --git a/lib/core-net/vhost.c b/lib/core-net/vhost.c index f788f1210..069252325 100644 --- a/lib/core-net/vhost.c +++ b/lib/core-net/vhost.c @@ -694,7 +694,7 @@ lws_create_vhost(struct lws_context *context, { #ifdef LWS_HAVE_GETENV p = getenv("http_proxy"); - if (p) + if (p && strlen(p) > 0 && strlen(p) < 95) lws_set_proxy(vh, p); #endif } @@ -709,7 +709,7 @@ lws_create_vhost(struct lws_context *context, } else { #ifdef LWS_HAVE_GETENV p = getenv("socks_proxy"); - if (p) + if (p && strlen(p) > 0 && strlen(p) < 95) lws_set_socks(vh, p); #endif } diff --git a/lib/roles/http/client/client.c b/lib/roles/http/client/client.c index 980f6a0c6..f4a4d5bdc 100644 --- a/lib/roles/http/client/client.c +++ b/lib/roles/http/client/client.c @@ -280,9 +280,10 @@ socks_reply_fail: } pt->serv_buf[13] = '\0'; - if (strcmp(sb, "HTTP/1.0 200 ") && - strcmp(sb, "HTTP/1.1 200 ")) { - lwsl_err("ERROR proxy: %s\n", sb); + if (strncmp(sb, "HTTP/1.0 200 ", 13) && + strncmp(sb, "HTTP/1.1 200 ", 13)) { + lwsl_err("%s: ERROR proxy did not reply with h1\n", + __func__); goto bail3; }