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

Signed-off-by: Haoyang Chen <chenhaoyang@uniontech.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Haoyang Chen 2021-04-07 18:01:38 +08:00 committed by Alexandre Julliard
parent 326f44e1c7
commit f547592bd2
2 changed files with 13 additions and 2 deletions

View File

@ -1854,7 +1854,7 @@ static BOOL run_script( char *script, DWORD size, const WCHAR *url, WINHTTP_PROX
uc.dwStructSize = sizeof(uc); uc.dwStructSize = sizeof(uc);
uc.dwHostNameLength = -1; uc.dwHostNameLength = -1;
if (WinHttpCrackUrl( url, 0, 0, &uc )) if ((ret = WinHttpCrackUrl( url, 0, 0, &uc )))
{ {
char *hostnameA = strdupWA_sized( uc.lpszHostName, uc.dwHostNameLength ); 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( hostnameA );
} }
heap_free( urlA ); heap_free( urlA );
return InternetDeInitializeAutoProxyDll( NULL, 0 ); InternetDeInitializeAutoProxyDll( NULL, 0 );
return ret;
} }
/*********************************************************************** /***********************************************************************

View File

@ -4974,6 +4974,9 @@ static void test_WinHttpGetProxyForUrl(void)
trace("Proxy.ProxyBypass=%s\n", wine_dbgstr_w(info.lpszProxyBypass)); trace("Proxy.ProxyBypass=%s\n", wine_dbgstr_w(info.lpszProxyBypass));
GlobalFree( info.lpszProxy ); GlobalFree( info.lpszProxy );
GlobalFree( info.lpszProxyBypass ); GlobalFree( info.lpszProxyBypass );
ret = WinHttpGetProxyForUrl( session, L"http:", &options, &info );
ok( !ret, "expected failure\n" );
} }
options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
@ -4990,6 +4993,13 @@ static void test_WinHttpGetProxyForUrl(void)
GlobalFree( info.lpszProxy ); GlobalFree( info.lpszProxy );
GlobalFree( info.lpszProxyBypass ); 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 ); WinHttpCloseHandle( session );
} }