winhttp(2/12): Support getting the default proxy settings from the http_proxy environment variable
Juan Lang
juan.lang at gmail.com
Mon Jul 13 15:08:44 CDT 2009
--Juan
-------------- next part --------------
From 86a1f2a2330524a862a317bf50528a3bc788eb41 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Fri, 10 Jul 2009 12:36:58 -0700
Subject: [PATCH 02/12] Support getting the default proxy settings from the http_proxy environment variable
---
dlls/winhttp/session.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 6378b1a..f37b34d 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -21,6 +21,7 @@
#include "wine/debug.h"
#include <stdarg.h>
+#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
@@ -679,6 +680,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
LONG l;
HKEY key;
BOOL direct = TRUE;
+ char *envproxy;
TRACE("%p\n", info);
@@ -741,6 +743,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));
}
}
}
@@ -749,6 +754,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;
--
1.6.3.2
More information about the wine-patches
mailing list