Provide better experience to Windows proxy users.#48
Provide better experience to Windows proxy users.#48reitowo wants to merge 12 commits intomicrosoft:mainfrom reitowo:main
Conversation
I did that because I could not find an HTTPS proxy to test against, and have never seen an HTTPS proxy deployed in the wild. Plain HTTP proxies are common but HTTPS ones aren't. Proxies kinda defeat the purpose of TLS in most cases. Moreover, the "automatic proxy" behavior creates differences in behavior in the tool; the vast majority of the vcpkg catalog use download mechanisms that don't respect WinHTTP's proxy settings or WPAD.
Neither of those indicate that IsWindows8Point1OrGreater are deprecated. They indicate that one should normally use feature testing rather than operating system version checks. As in, we should try to use the new feature, and if that fails, fall back to not using the new feature. Changing it to use RtlGetVersion instead doesn't resolve what any of that is complaining about. If you want the normal functions to have the desired behavior the correct fix is to add a manifest indicating the highest tested operating system version ( https://docs.microsoft.com/en-us/windows/win32/sysinfo/targeting-your-application-at-windows-8-1 ). Do you have an actual HTTPS proxy against which the behavior can be tested? When I wrote |
I use a v2ray proxy by setting HTTPS_PROXY to http://127.0.0.1:10809 which works well, does that mean a "HTTPS proxy"?
According to the link you provided they say:
Which clearly says that these API are deprecated, and providing an manifest seems just a workaround. It seems no replacing API is provided by Windows. However use RtlGetVersion will give correct OS version value. I also don't know why should and how to add an manifest. |
That's not an HTTPS proxy. That's an HTTP proxy. (It even says
Manifests are the documented / supported way of doing this. |
|
Also, i write an proxy detection code by detecting the registry, and set the proxyserver to env list. This is because cmake |
That's true, but should a HTTP proxy supports https requests? Because all https downloads are proxy-able by this proxy. |
|
@BillyONeal Also, please check my latest commit which reads Windows proxy settings and manually set the server address to environment list, I think it is way more user friendly to Windows proxy users. |
This argues even more for not turning on WPAD because it makes different parts of vcpkg inconsistent with each other since some parts would be doing WPAD and some parts would not be.
I tried proxies configured in this way when I wrote Overall I think it should go like this: The vcpkg probably has the Personally I think we should not support WPAD and should support HTTPS_PROXY for consistency with cmake which we use to download lots of other things. I would have already done that to |
|
I'll bring this up with other maintainers to get answers to / confirmation of the above questions. |
|
@BillyONeal I tested on these IsXXXOrGreater and they do failed on OS versions above 8.1, which cause some if statements always false. We should either provide manifest or use other Rtl APIs. Also, using HTTP(S)_PROXY does have consistency, but I also find out that vcpkg will generate environment variable list when starting other executables, where we can detect Windows IE Proxy settings in registry and manually insert HTTP(S)_PROXY variables to that list (Just like the last few commits do). This doesn't break the consistency and provide better experience. |
Right, they still require a manifest. The purpose of the manifest is to tell the OS what the latest version of the OS we tested with is.
If we can create consistent behavior that would be fine by me -- the most important thing as far as I'm concerned is that we respond to proxies consistently in the product, and right now the only thing we can do reasonably consistently are the environment variables. If we can set the environment appropriately that would be fine too. Although I don't see the output you describe and don't see anywhere in the tool where such behavior is being applied... |
It is in this PR's last 5 commits. However tls12-download.exe is called by bootstrap.ps1. Users also need to set variables before calling bootstrap. Does WPAD refer to WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY? If so, we can also read the registry just like my last few commits does and prevent WPAD. It will be nice if we provide --proxy or --auto-detect-proxy etc. switches. Providing switches satisfies both kind of users. |
🤦♂️ Sorry!
Right, if we're setting those variables making bootstrap respond to the settings in a consistent way is good.
Yes. WPAD == Web Proxy Auto Discovery; it's what |
Oh, thanks! BTW, does the auto check failure my fault? It seems always stuck at Make Diff or Building rapidjson |
|
@BillyONeal |
…or IE Proxy setting
|
Too complicated for a PR, will reopen a new one. |

There are several places I modified:
tls12-download.cThis file doesn't use Windows proxy settings when
HTTPS_PROXYenv variable not found. The correct manner should be useaccess_type = IsWindows8Point1OrGreater() ? WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY : WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;, not just settingWINHTTP_ACCESS_TYPE_NO_PROXYas it is inconvenient to set env variable on Windows.src/vcpkg/base/downloads.cppVersionHelper.h (IsWindows8Point1OrGreater, etc..) is deprecated. See this and remark section in this. Applications not manifested for Windows 8.1 or Windows 10 return false, even if the current operating is 8.1 or 10. So we need to do use RtlGetVersion to get correct OS version. Currently the program doesn't seems to have a manifest, and wrongly setting proxies.
pch.hWhere i will use registry functions
system.proxy.h/.cppWrite an helper function to determine whether there's a active Windows proxy setting.
build.cppAt
System::Environment& EnvCache::get_action_envI added the proxy detection and add the HTTP_PROXY and HTTPS_PROXY variables to env list.