Haoyang Chen : winhttp: Invalid url decomposition should return failure when it fails.

Alexandre Julliard julliard at winehq.org
Wed Apr 7 15:48:30 CDT 2021


Module: wine
Branch: master
Commit: f547592bd2173eec9fcb6ef27363a3bd83348f01
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f547592bd2173eec9fcb6ef27363a3bd83348f01

Author: Haoyang Chen <chenhaoyang at uniontech.com>
Date:   Wed Apr  7 18:01:38 2021 +0800

winhttp: Invalid url decomposition should return failure when it fails.

Signed-off-by: Haoyang Chen <chenhaoyang at uniontech.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winhttp/session.c       |  5 +++--
 dlls/winhttp/tests/winhttp.c | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 319066db55b..f052c3c569c 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -1854,7 +1854,7 @@ static BOOL run_script( char *script, DWORD size, const WCHAR *url, WINHTTP_PROX
     uc.dwStructSize = sizeof(uc);
     uc.dwHostNameLength = -1;
 
-    if (WinHttpCrackUrl( url, 0, 0, &uc ))
+    if ((ret = WinHttpCrackUrl( url, 0, 0, &uc )))
     {
         char *hostnameA = strdupWA_sized( uc.lpszHostName, uc.dwHostNameLength );
 
@@ -1868,7 +1868,8 @@ static BOOL run_script( char *script, DWORD size, const WCHAR *url, WINHTTP_PROX
         heap_free( hostnameA );
     }
     heap_free( urlA );
-    return InternetDeInitializeAutoProxyDll( NULL, 0 );
+    InternetDeInitializeAutoProxyDll( NULL, 0 );
+    return ret;
 }
 
 /***********************************************************************
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 6a61a23ec02..56f35252615 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -4974,6 +4974,9 @@ static void test_WinHttpGetProxyForUrl(void)
         trace("Proxy.ProxyBypass=%s\n", wine_dbgstr_w(info.lpszProxyBypass));
         GlobalFree( info.lpszProxy );
         GlobalFree( info.lpszProxyBypass );
+
+        ret = WinHttpGetProxyForUrl( session, L"http:", &options, &info );
+        ok( !ret, "expected failure\n" );
     }
 
     options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
@@ -4990,6 +4993,13 @@ static void test_WinHttpGetProxyForUrl(void)
         GlobalFree( info.lpszProxy );
         GlobalFree( info.lpszProxyBypass );
     }
+
+    options.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;
+    options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP|WINHTTP_AUTO_DETECT_TYPE_DNS_A;
+
+    ret = WinHttpGetProxyForUrl( session, L"http:", &options, &info );
+    ok( !ret, "expected failure\n" );
+
     WinHttpCloseHandle( session );
 }
 




More information about the wine-cvs mailing list