winhttp: Support getting the default proxy settings from the http_proxy environment variable.

This commit is contained in:
Juan Lang 2009-07-14 13:01:26 -07:00 committed by Alexandre Julliard
parent fd9aa244d3
commit 51e54a8b75
1 changed files with 22 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "wine/debug.h"
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
@ -686,6 +687,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
LONG l;
HKEY key;
BOOL direct = TRUE;
char *envproxy;
TRACE("%p\n", info);
@ -749,6 +751,9 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
direct = FALSE;
info->dwAccessType =
WINHTTP_ACCESS_TYPE_NAMED_PROXY;
TRACE("http proxy (from registry) = %s, bypass = %s\n",
debugstr_w(info->lpszProxy),
debugstr_w(info->lpszProxyBypass));
}
}
}
@ -757,6 +762,23 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
}
RegCloseKey( key );
}
else if ((envproxy = getenv( "http_proxy" )))
{
WCHAR *envproxyW;
int len;
len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
if ((envproxyW = GlobalAlloc( 0, len * sizeof(WCHAR))))
{
MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
direct = FALSE;
info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
info->lpszProxy = envproxyW;
info->lpszProxyBypass = NULL;
TRACE("http proxy (from environment) = %s\n",
debugstr_w(info->lpszProxy));
}
}
if (direct)
{
info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;