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

Alexandre Julliard julliard at winehq.org
Wed Jul 15 09:46:54 CDT 2009


Module: wine
Branch: master
Commit: 51e54a8b75d8e9ce8e282633ff8dde13c3119669
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=51e54a8b75d8e9ce8e282633ff8dde13c3119669

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Jul 14 13:01:26 2009 -0700

winhttp: 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 17a0a5f..8a9a039 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"
@@ -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;




More information about the wine-cvs mailing list