winhttp: Ignore empty proxy strings read from the environment.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2018-05-23 11:36:44 +02:00 committed by Alexandre Julliard
parent 5bc81188fe
commit 2752da05db
1 changed files with 9 additions and 18 deletions

View File

@ -1597,29 +1597,21 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
} }
if (!got_from_reg && (envproxy = getenv( "http_proxy" ))) if (!got_from_reg && (envproxy = getenv( "http_proxy" )))
{ {
char *colon, *http_proxy; char *colon, *http_proxy = NULL;
if ((colon = strchr( envproxy, ':' ))) if (!(colon = strchr( envproxy, ':' ))) http_proxy = envproxy;
else
{ {
if (*(colon + 1) == '/' && *(colon + 2) == '/') if (*(colon + 1) == '/' && *(colon + 2) == '/')
{ {
static const char http[] = "http://";
/* It's a scheme, check that it's http */ /* It's a scheme, check that it's http */
if (!strncmp( envproxy, http, strlen( http ) )) if (!strncmp( envproxy, "http://", 7 )) http_proxy = envproxy + 7;
http_proxy = envproxy + strlen( http ); else WARN("unsupported scheme in $http_proxy: %s\n", envproxy);
else
{
WARN("unsupported scheme in $http_proxy: %s\n", envproxy);
http_proxy = NULL;
} }
else http_proxy = envproxy;
} }
else
http_proxy = envproxy; if (http_proxy && http_proxy[0])
}
else
http_proxy = envproxy;
if (http_proxy)
{ {
WCHAR *http_proxyW; WCHAR *http_proxyW;
int len; int len;
@ -1632,8 +1624,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
info->lpszProxy = http_proxyW; info->lpszProxy = http_proxyW;
info->lpszProxyBypass = NULL; info->lpszProxyBypass = NULL;
TRACE("http proxy (from environment) = %s\n", TRACE("http proxy (from environment) = %s\n", debugstr_w(info->lpszProxy));
debugstr_w(info->lpszProxy));
} }
} }
} }