-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use "IE Proxy Settings" correctly on Windows in vcpkg. (#49)
* Unify design, abandon WPAD, manually detects IE Proxy at "tls12-download.c", "vcpkg/base/downloads.cpp". Add an helper code in "build.cpp:409" to make setting proxy easier. * Meet @BillyONeal's review * Formatting * Python's proxy detection * Use vcpkg::Optional * Allow mismatches protocol and address prefix
- Loading branch information
Showing
5 changed files
with
153 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <vcpkg/base/optional.h> | ||
|
||
#include <string> | ||
|
||
/* | ||
* This is a helper class. It reads IE Proxy settings. | ||
* For coherence of vcpkg design "using HTTP(S)_PROXY not WPAD", it is a user-friendly design to manually | ||
* read the IE Proxy settings on Windows, and set the environment variables HTTP(S)_PROXY to the same | ||
* when starting an external program (like CMake, which file(DOWNLOAD) only accept proxy settings | ||
* by HTTP(S)_PROXY variables). | ||
*/ | ||
|
||
namespace vcpkg::System | ||
{ | ||
struct IEProxySetting | ||
{ | ||
std::wstring server; | ||
std::wstring bypass; | ||
}; | ||
|
||
vcpkg::Optional<IEProxySetting> get_windows_ie_proxy_server(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <vcpkg/base/system.proxy.h> | ||
|
||
vcpkg::Optional<vcpkg::System::IEProxySetting> vcpkg::System::get_windows_ie_proxy_server() | ||
{ | ||
#if defined(_WIN32) | ||
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxy; | ||
if (WinHttpGetIEProxyConfigForCurrentUser(&ieProxy) && ieProxy.lpszProxy != nullptr) | ||
{ | ||
vcpkg::System::IEProxySetting ieProxySetting; | ||
|
||
ieProxySetting.server = ieProxy.lpszProxy; | ||
|
||
if (ieProxy.lpszProxyBypass != nullptr) ieProxySetting.bypass = ieProxy.lpszProxyBypass; | ||
|
||
GlobalFree(ieProxy.lpszProxy); | ||
GlobalFree(ieProxy.lpszProxyBypass); | ||
GlobalFree(ieProxy.lpszAutoConfigUrl); | ||
|
||
return ieProxySetting; | ||
} | ||
return vcpkg::Optional<vcpkg::System::IEProxySetting>(); | ||
#else | ||
return vcpkg::Optional<vcpkg::System::IEProxySetting>(); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters