proxy auth fix

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2015-11-18 19:32:01 +08:00
parent d55ac45c39
commit f2280d6ce7
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@ struct libwebsocket *libwebsocket_client_connect_2(
lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS),
wsi->u.hdr.ah->c_port);
if (context->proxy_basic_auth_token)
if (context->proxy_basic_auth_token[0])
plen += sprintf((char *)context->service_buffer + plen,
"Proxy-authorization: basic %s\x0d\x0a",
context->proxy_basic_auth_token);

View file

@ -714,7 +714,7 @@ libwebsocket_set_proxy(struct libwebsocket_context *context, const char *proxy)
if ((unsigned int)(p - proxy) > sizeof(authstring) - 1)
goto auth_too_long;
strncpy(authstring + 6, proxy, p - proxy);
strncpy(authstring, proxy, p - proxy);
// null termination not needed on input
if (lws_b64_encode_string(authstring, (p - proxy),
context->proxy_basic_auth_token,