Add missing WinHttpOpen to resolve pac proxies

This commit is contained in:
Marek Roszko 2021-11-11 22:56:45 -05:00
parent b20317ca84
commit 009bb7f033
1 changed files with 9 additions and 5 deletions

View File

@ -128,7 +128,7 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG&
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxyConfig = { 0 }; WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxyConfig = { 0 };
WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions = { 0 }; WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions = { 0 };
WINHTTP_PROXY_INFO autoProxyInfo = { 0 }; WINHTTP_PROXY_INFO autoProxyInfo = { 0 };
HINTERNET session = NULL; HINTERNET proxyResolveSession = NULL;
bool success = false; bool success = false;
if( WinHttpGetIEProxyConfigForCurrentUser( &ieProxyConfig ) ) if( WinHttpGetIEProxyConfigForCurrentUser( &ieProxyConfig ) )
@ -153,6 +153,10 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG&
if( autoProxyDetect ) if( autoProxyDetect )
{ {
proxyResolveSession =
WinHttpOpen( L"kicad", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, WINHTTP_FLAG_ASYNC );
// either we use the ie url or we set the auto detect mode // either we use the ie url or we set the auto detect mode
if( autoProxyOptions.lpszAutoConfigUrl != NULL ) if( autoProxyOptions.lpszAutoConfigUrl != NULL )
{ {
@ -167,12 +171,12 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG&
autoProxyOptions.fAutoLogonIfChallenged = TRUE; autoProxyOptions.fAutoLogonIfChallenged = TRUE;
autoProxyDetect = autoProxyDetect = WinHttpGetProxyForUrl( proxyResolveSession, aURL.c_str(),
WinHttpGetProxyForUrl( session, aURL.c_str(), &autoProxyOptions, &autoProxyInfo ); &autoProxyOptions, &autoProxyInfo );
if( session ) if( proxyResolveSession )
{ {
WinHttpCloseHandle( session ); WinHttpCloseHandle( proxyResolveSession );
} }
} }