microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.99k stars 6.34k forks source link

Can't bootstrap under proxy #33118

Open kehrazy opened 1 year ago

kehrazy commented 1 year ago

Describe the bug With HTTP{S}_PROXY environment variables set, bootstrap_vcpkg script errors out.

Environment

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/microsoft/vcpkg
  2. cd vcpkg
  3. bootstrap_vcpkg.bat
  4. See error.

Expected behavior vcpkg installs successfuly.

Failure logs

Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2023-08-09/vcpkg.exe -> C:\bin\vcpkg\vcpkg.exe (using proxy: http://login:password@my_awesome_proxy:my_awesome_port)While calling Windows API function WinHttpOpen got error 0x00000057:
Параметр задан неверно.

..path\to\vcpkg\scripts\bootstrap.ps1: Downloading vcpkg.exe failed. Please check your internet connection, or consider d
ownloading a recent vcpkg.exe from https://github.com/microsoft/vcpkg-tool with a browser.
At line:1 char:4
+ & {& 'C:\bin\vcpkg\scripts\bootstrap.ps1' }
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,bootstrap.ps1

ScriptHalted
At C:\bin\vcpkg\scripts\bootstrap.ps1:63 char:5
+     throw
+     ~~~~~
    + CategoryInfo          : OperationStopped: (:) [], RuntimeException
    + FullyQualifiedErrorId : ScriptHalted

Additional context There is really no point in downloading the .exe manually - the exe doesn't seem to work either.

Osyotr commented 1 year ago

Maybe it's because you use http proxy for https?

kehrazy commented 1 year ago

Maybe it's because you use http proxy for https?

no, the proxy accepts http, then redirects to https:// on request.

the error is not on my part - vcpkg (probably) shouldn't call WinHttpOpen to connect to an https endpoint :)

Osyotr commented 1 year ago

Are you able to download vcpkg.exe directly? https://github.com/microsoft/vcpkg-tool/releases/download/2023-08-09/vcpkg.exe

kehrazy commented 1 year ago

Are you able to download vcpkg.exe directly? https://github.com/microsoft/vcpkg-tool/releases/download/2023-08-09/vcpkg.exe

Yes, I am, which i mentioned in the initial message. However, vcpkg.exe seems to use the same export.

Cheney-W commented 1 year ago

@kehrazy How did you set the HTTP{S}_PROXY? What is its value? You mentioned that the manually downloaded vcpkg.exe also doesn't work properly. What is the error when you run it?

kehrazy commented 1 year ago

@kehrazy How did you set the HTTP{S}_PROXY? What is its value?

Through the "System Environment Variables" menu. It has a format of http://{login}:{pass}@{proxy_host}:{proxy_port}. HTTPS proxies are handled through HTTP, that's how our company proxies are set up.

You mentioned that the manually downloaded vcpkg.exe also doesn't work properly. What is the error when you run it?

Will update this thread in a couple of days.

github-actions[bot] commented 1 year ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

kehrazy commented 1 year ago

@Cheney-W Sorry for the late response.

You mentioned that the manually downloaded vcpkg.exe also doesn't work properly. What is the error when you run it?

warning: Download failed -- retrying after *ms

WinHttpSendRequest failed with exit code 12002

The issue does not seem to be on my end - I am able to download files via wget/curl..

lstavares84 commented 11 months ago

Are you able to download vcpkg.exe directly? https://github.com/microsoft/vcpkg-tool/releases/download/2023-08-09/vcpkg.exe

Download VCPKG.exe, put in the same folder where git clone downloaded and run in powershell "./vcpkg integrate install".

Check this video: https://www.youtube.com/watch?v=0h1lC3QHLHU

kehrazy commented 11 months ago

Are you able to download vcpkg.exe directly? https://github.com/microsoft/vcpkg-tool/releases/download/2023-08-09/vcpkg.exe

Download VCPKG.exe, put in the same folder where git clone downloaded and run in powershell "./vcpkg integrate install".

Check this video: https://www.youtube.com/watch?v=0h1lC3QHLHU

Once again, vcpkg seems to download all https:// related urls via WinHttpSendRequest, which does not work.

zpostfacto commented 7 months ago

I'm hitting this same problem.

I have the environment variable set, and winhttp knows about my proxy:

f:\dev\GameNetworkingSockets\master>echo %https_proxy%
http://proxy:3128/

f:\dev\GameNetworkingSockets\master>netsh winhttp show proxy

Current WinHTTP proxy settings:

    Proxy Server(s) :  proxy:3128
    Bypass List     :  (none)

vcpkg was unable to download vcpkg.exe to bootstrap. I manually downloaded vcpkg.exe, but then I get the same basic problem trying to download portable cmake:

f:\dev\GameNetworkingSockets\master>.\vcpkg\vcpkg install --triplet=x64-windows
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip->F:\dev\GameNetworkingSockets\master\vcpkg\downloads\cmake-3.27.1-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip
warning: Download failed -- retrying after 1000ms
warning: Download failed -- retrying after 2000ms
warning: Download failed -- retrying after 4000ms
error: Failed to download from mirror set
error: https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip: WinHttpSendRequest failed with exit code 12002
error: https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip: WinHttpSendRequest failed with exit code 12002
error: https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip: WinHttpSendRequest failed with exit code 12002
error: https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip: WinHttpSendRequest failed with exit code 12002

I am able to download any of these URLs that vcpkg is failing on in Chrome. curl also works (the URL generates a 302, so you have to add -L and curl will emit two lines).

f:\dev\GameNetworkingSockets\master>curl -L https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip -o F:\dev\GameNetworkingSockets\master\vcpkg\downloads\cmake-3.27.1-windows-i386.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 38.7M  100 38.7M    0     0  46.4M      0 --:--:-- --:--:-- --:--:--  112M

I know that this used to work at some point.

htlpt commented 3 months ago

Just unset both http(s)_proxy for bootstrap. That worked for me..

kehrazy commented 2 months ago

Just unset both http(s)_proxy for bootstrap. That worked for me..

You'll most likely hit a 407 behind a proxy. This won't work.

kehrazy commented 2 months ago

This open issue is almost a year old!

Getting the cake ready.

Seriously guys, this is stupid.

zpostfacto commented 1 month ago

Still having this issue.

f:\dev\GameNetworkingSockets\master>set HTTP_PROXY
HTTP_PROXY=http://proxy:3128/

f:\dev\GameNetworkingSockets\master>set HTTPS_PROXY
HTTPS_PROXY=http://proxy:3128/

f:\dev\GameNetworkingSockets\master>netsh winhttp show proxy

Current WinHTTP proxy settings:

    Proxy Server(s) :  proxy:3128
    Bypass List     :  (none)

f:\dev\GameNetworkingSockets\master>.\vcpkg\bootstrap-vcpkg.bat
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2024-08-01/vcpkg.exe -> F:\dev\GameNetworkingSockets\master\vcpkg\vcpkg.exe (using proxy: http://proxy:3128/)While calling Windows API function WinHttpOpen got error 0x00000057:
The parameter is incorrect.

F:\dev\GameNetworkingSockets\master\vcpkg\scripts\bootstrap.ps1 : Downloading vcpkg.exe failed. Please check your internet connection, or consider
downloading a recent vcpkg.exe from https://github.com/microsoft/vcpkg-tool with a browser.
At line:1 char:4
+ & {& "f:\dev\GameNetworkingSockets\master\vcpkg\scripts\bootstrap.ps1 ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,bootstrap.ps1

ScriptHalted
At F:\dev\GameNetworkingSockets\master\vcpkg\scripts\bootstrap.ps1:63 char:5
+     throw
+     ~~~~~
    + CategoryInfo          : OperationStopped: (:) [], RuntimeException
    + FullyQualifiedErrorId : ScriptHalted

I can work around the first problem using curl (which demonstrates that it is definitely a problem with vcpkg, and not my computer or the proxy):


f:\dev\GameNetworkingSockets\master>curl -L -o vcpkg\vcpkg.exe https://github.com/microsoft/vcpkg-tool/releases/download/2024-08-01/vcpkg.exe
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 7928k  100 7928k    0     0  13.7M      0 --:--:-- --:--:-- --:--:--  116M

And I also manually installed powershell. But I am not sure how to get past this:

f:\dev\GameNetworkingSockets\master>7z

7-Zip 24.08 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-08-11
...<snip>...

f:\dev\GameNetworkingSockets\master>vcpkg\vcpkg install --triplet x64-windows
Detecting compiler hash for triplet x64-windows...
-- Using %HTTP(S)_PROXY% in environment variables.
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
  * abseil:x64-windows@20240722.0
    openssl:x64-windows@3.3.1#1
    protobuf:x64-windows@4.25.1#1
  * utf8-range:x64-windows@4.25.1
  * vcpkg-cmake:x64-windows@2024-04-23
  * vcpkg-cmake-config:x64-windows@2024-05-23
  * vcpkg-cmake-get-vars:x64-windows@2023-12-31
Additional packages (*) will be modified to complete this operation.
A suitable version of 7zip was not found (required v24.8.0).
warning: Download failed -- retrying after 1000ms
warning: Download failed -- retrying after 2000ms
warning: Download failed -- retrying after 4000ms
error: Missing 7z2408-extra.7z and downloads are blocked by x-block-origin.
error: https://github.com/ip7z/7zip/releases/download/24.08/7z2408-extra.7z: WinHttpSendRequest failed with exit code 12002
error: https://github.com/ip7z/7zip/releases/download/24.08/7z2408-extra.7z: WinHttpSendRequest failed with exit code 12002
error: https://github.com/ip7z/7zip/releases/download/24.08/7z2408-extra.7z: WinHttpSendRequest failed with exit code 12002
error: https://github.com/ip7z/7zip/releases/download/24.08/7z2408-extra.7z: WinHttpSendRequest failed with exit code 12002