winhttp: Handle http_proxy variable entirely in Unicode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ae3b334695
commit
86f43b693a
|
@ -1534,7 +1534,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
|
||||||
LONG l;
|
LONG l;
|
||||||
HKEY key;
|
HKEY key;
|
||||||
BOOL got_from_reg = FALSE, direct = TRUE;
|
BOOL got_from_reg = FALSE, direct = TRUE;
|
||||||
char *envproxy;
|
WCHAR *envproxy;
|
||||||
|
|
||||||
TRACE("%p\n", info);
|
TRACE("%p\n", info);
|
||||||
|
|
||||||
|
@ -1610,37 +1610,30 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
|
||||||
}
|
}
|
||||||
RegCloseKey( key );
|
RegCloseKey( key );
|
||||||
}
|
}
|
||||||
if (!got_from_reg && (envproxy = getenv( "http_proxy" )))
|
if (!got_from_reg && (envproxy = _wgetenv( L"http_proxy" )))
|
||||||
{
|
{
|
||||||
char *colon, *http_proxy = NULL;
|
WCHAR *colon, *http_proxy = NULL;
|
||||||
|
|
||||||
if (!(colon = strchr( envproxy, ':' ))) http_proxy = envproxy;
|
if (!(colon = wcschr( envproxy, ':' ))) http_proxy = envproxy;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*(colon + 1) == '/' && *(colon + 2) == '/')
|
if (*(colon + 1) == '/' && *(colon + 2) == '/')
|
||||||
{
|
{
|
||||||
/* It's a scheme, check that it's http */
|
/* It's a scheme, check that it's http */
|
||||||
if (!strncmp( envproxy, "http://", 7 )) http_proxy = envproxy + 7;
|
if (!wcsncmp( envproxy, L"http://", 7 )) http_proxy = envproxy + 7;
|
||||||
else WARN("unsupported scheme in $http_proxy: %s\n", envproxy);
|
else WARN("unsupported scheme in $http_proxy: %s\n", debugstr_w(envproxy));
|
||||||
}
|
}
|
||||||
else http_proxy = envproxy;
|
else http_proxy = envproxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (http_proxy && http_proxy[0])
|
if (http_proxy && http_proxy[0])
|
||||||
{
|
{
|
||||||
WCHAR *http_proxyW;
|
direct = FALSE;
|
||||||
int len;
|
info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
|
||||||
|
info->lpszProxy = GlobalAlloc( 0, (lstrlenW(http_proxy) + 1) * sizeof(WCHAR) );
|
||||||
len = MultiByteToWideChar( CP_UNIXCP, 0, http_proxy, -1, NULL, 0 );
|
wcscpy( info->lpszProxy, http_proxy );
|
||||||
if ((http_proxyW = GlobalAlloc( 0, len * sizeof(WCHAR))))
|
info->lpszProxyBypass = NULL;
|
||||||
{
|
TRACE("http proxy (from environment) = %s\n", debugstr_w(info->lpszProxy));
|
||||||
MultiByteToWideChar( CP_UNIXCP, 0, http_proxy, -1, http_proxyW, len );
|
|
||||||
direct = FALSE;
|
|
||||||
info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
|
|
||||||
info->lpszProxy = http_proxyW;
|
|
||||||
info->lpszProxyBypass = NULL;
|
|
||||||
TRACE("http proxy (from environment) = %s\n", debugstr_w(info->lpszProxy));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direct)
|
if (direct)
|
||||||
|
|
Loading…
Reference in New Issue