Hans Leidekker : winhttp: Fix the error returned from WinHttpGetProxyForUrl when autodetection fails .
Alexandre Julliard
julliard at winehq.org
Thu Nov 1 14:42:58 CDT 2012
Module: wine
Branch: master
Commit: 8ca3e80ddd7bf291ec118e147f64559726cb7259
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8ca3e80ddd7bf291ec118e147f64559726cb7259
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Nov 1 14:45:59 2012 +0100
winhttp: Fix the error returned from WinHttpGetProxyForUrl when autodetection fails.
---
dlls/winhttp/session.c | 4 +---
dlls/winhttp/tests/winhttp.c | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 8ffcda1..3617b20 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -2024,10 +2024,8 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
}
if (options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT &&
!WinHttpDetectAutoProxyConfigUrl( options->dwAutoDetectFlags, &detected_pac_url ))
- {
- set_last_error( ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR );
goto done;
- }
+
if (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL) pac_url = options->lpszAutoConfigUrl;
else pac_url = detected_pac_url;
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 3bc686f..0f237d9 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -2620,6 +2620,7 @@ static void test_WinHttpGetIEProxyConfigForCurrentUser(void)
static void test_WinHttpGetProxyForUrl(void)
{
static const WCHAR urlW[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0};
+ static const WCHAR wpadW[] = {'h','t','t','p',':','/','/','w','p','a','d','/','w','p','a','d','.','d','a','t',0};
static const WCHAR emptyW[] = {0};
BOOL ret;
DWORD error;
@@ -2693,8 +2694,29 @@ static void test_WinHttpGetProxyForUrl(void)
options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DNS_A;
memset( &info, 0, sizeof(info) );
+ SetLastError(0xdeadbeef);
ret = WinHttpGetProxyForUrl( session, urlW, &options, &info );
- if (ret)
+ error = GetLastError();
+ if (!ret) ok( error == ERROR_WINHTTP_AUTODETECTION_FAILED, "got %u\n", error );
+ else
+ {
+ trace("%u\n", info.dwAccessType);
+ trace("%s\n", wine_dbgstr_w(info.lpszProxy));
+ trace("%s\n", wine_dbgstr_w(info.lpszProxyBypass));
+ GlobalFree( info.lpszProxy );
+ GlobalFree( info.lpszProxyBypass );
+ }
+
+ options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
+ options.dwAutoDetectFlags = 0;
+ options.lpszAutoConfigUrl = wpadW;
+
+ memset( &info, 0, sizeof(info) );
+ SetLastError(0xdeadbeef);
+ ret = WinHttpGetProxyForUrl( session, urlW, &options, &info );
+ error = GetLastError();
+ if (!ret) ok( error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n", error );
+ else
{
trace("%u\n", info.dwAccessType);
trace("%s\n", wine_dbgstr_w(info.lpszProxy));
More information about the wine-cvs
mailing list