Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell download fails behind proxy on windows: authentication not taken into account #38797

Closed
sylvlecl opened this issue May 17, 2024 · 0 comments
Assignees
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@sylvlecl
Copy link

sylvlecl commented May 17, 2024

Describe the bug

Same as #8078 and #7207:
behind our company proxy, on windows, the download of powershell timeouts.

The env variables HTTP_PROXY and HTTPS_PROXY are correctly set:

set HTTP_PROXY=http://login:password@company-proxy.com:1234
...

Indeed, the download of dependencies, which is performed with curl does work (after having installed vcpkg and base tools like powershell outside from the company network).

Some analysis

After a quick look at vcpkg-tool source code and at WinHTTP API, I suspect that the credentials part of the environment variables are not correctly provided to WinHTTP API.
Indeed, the API seems to expect the proxy URL, username, and password in separate options, whereas vcpkg provides the full content of HTTP_PROXY, including the credentials, as the proxy URL (see this line).

Indeed, when using windows provided command line tool to set those winhttp options, a URL with credentials is considered as "invalid parameter", which seems to confirm that winhttp expects a plain URL here:

>netsh winhttp set proxy http://toto:tt@test.com
Erreur lors de l'écriture des paramètres proxy. (87) Paramètre incorrect.

Environment

  • OS: Windows

To Reproduce

Behind a proxy requiring some credentials:

set HTTP_PROXY=http://login:password@company-proxy.com:1234
set HTTPS_PROXY=%HTTP_PROXY%
# Try install any port
vcpkg install jsoncpp

Expected behavior
I would expect the use of HTTP*_PROXY environment variables to be consistent between the downloads that use WinHTTP API and the downloads which use CURL, so that I just need to set those environment variables to have the whole chain working, like on Linux.

@microsoft microsoft locked and limited conversation to collaborators May 20, 2024
@LilyWangLL LilyWangLL converted this issue into discussion #38827 May 20, 2024
@LilyWangLL LilyWangLL added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label May 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

No branches or pull requests

2 participants