diff --git a/libs/kiplatform/msw/environment.cpp b/libs/kiplatform/msw/environment.cpp index 3859f61adc..326cee8bdc 100644 --- a/libs/kiplatform/msw/environment.cpp +++ b/libs/kiplatform/msw/environment.cpp @@ -128,7 +128,7 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG& WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxyConfig = { 0 }; WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions = { 0 }; WINHTTP_PROXY_INFO autoProxyInfo = { 0 }; - HINTERNET session = NULL; + HINTERNET proxyResolveSession = NULL; bool success = false; if( WinHttpGetIEProxyConfigForCurrentUser( &ieProxyConfig ) ) @@ -153,6 +153,10 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG& 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 if( autoProxyOptions.lpszAutoConfigUrl != NULL ) { @@ -167,12 +171,12 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG& autoProxyOptions.fAutoLogonIfChallenged = TRUE; - autoProxyDetect = - WinHttpGetProxyForUrl( session, aURL.c_str(), &autoProxyOptions, &autoProxyInfo ); + autoProxyDetect = WinHttpGetProxyForUrl( proxyResolveSession, aURL.c_str(), + &autoProxyOptions, &autoProxyInfo ); - if( session ) + if( proxyResolveSession ) { - WinHttpCloseHandle( session ); + WinHttpCloseHandle( proxyResolveSession ); } }