From 73895b3279266cb0951b4059e48226d3b5f09619 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Fri, 3 May 2013 17:11:48 -0700 Subject: [PATCH] wininet: Accept ProxyBypass from environment or registry. --- dlls/wininet/internet.c | 43 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index dc0c89ca83e..b9f3e9883b6 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -116,6 +116,7 @@ static const WCHAR szInternetSettings[] = 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0 }; static const WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 }; static const WCHAR szProxyEnable[] = { 'P','r','o','x','y','E','n','a','b','l','e', 0 }; +static const WCHAR szProxyOverride[] = { 'P','r','o','x','y','O','v','e','r','r','i','d','e', 0 }; void *alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size) { @@ -610,9 +611,49 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->proxy)); } - RegCloseKey( key ); lpwpi->proxyBypass = NULL; + if (lpwpi->proxyEnabled) + { + if (!(envproxy = getenv( "no_proxy" ))) + { + /* figure out how much memory the proxy setting takes */ + if (!RegQueryValueExW( key, szProxyOverride, NULL, &type, NULL, &len ) && len && (type == REG_SZ)) + { + LPWSTR szProxy; + + if (!(szProxy = heap_alloc(len))) + { + RegCloseKey( key ); + return ERROR_OUTOFMEMORY; + } + RegQueryValueExW( key, szProxyOverride, NULL, &type, (BYTE*)szProxy, &len ); + + lpwpi->proxyBypass = szProxy; + + TRACE("http proxy bypass = %s\n", debugstr_w(lpwpi->proxyBypass)); + } + else + { + TRACE("No proxy bypass server settings in registry.\n"); + } + } + else if (envproxy) + { + WCHAR *envproxyW; + + len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 ); + if (!(envproxyW = heap_alloc(len * sizeof(WCHAR)))) + return ERROR_OUTOFMEMORY; + MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len ); + + lpwpi->proxyBypass = envproxyW; + + TRACE("http proxy bypass (from environment) = %s\n", debugstr_w(lpwpi->proxyBypass)); + } + } + + RegCloseKey( key ); return ERROR_SUCCESS; }