Vcpkg: WinHttpSendRequest() failed: 12002

Created on 9 Jul 2019  路  22Comments  路  Source: microsoft/vcpkg

I have some problems downloading powershell core. Shouldn't we use aria?

PS E:\Code\vcpkg> .\vcpkg.exe install darknet[opencv-cuda]
The following packages will be built and installed:
    darknet[core,opencv-cuda,weights]:x64-windows
Starting package 1/1: darknet:x64-windows
Building package darknet[core,opencv-cuda,weights]:x64-windows...
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Downloading powershell-core...
  https://github.com/PowerShell/PowerShell/releases/download/v6.2.1/PowerShell-6.2.1-win-x86.zip -> E:\Codice\vcpkg\downloads\PowerShell-6.2.1-win-x86.zip
WinHttpSendRequest() failed: 12002

Most helpful comment

We have exactly the same issue in our organisation. Having looked at it for a couple of hours this morning and reading all the associated issues and links, I have found that for us it is an I.T. problem more than anything that can be resolved in code.

The link that solved our problem was provided in issue #4729.
https://blogs.technet.microsoft.com/netgeeks/2018/06/19/winhttp-proxy-settings-deployed-by-gpo/

This states that there are two proxy mechanisms in Windows.

  • Internet Settings Control Panel
  • WinHTTP Windows Services

VcPkg is now affected by both.
The former (which requires you to set the 'HTTP_PROXY' and 'HTTPS_PROXY' variables) is used when downloading packages.
The later is used by the WinHTTP API, which VcPkg now uses to download the tools such as PowerShell Core, 7Zip, Nuget etc....

In our organisation the Control Panel proxy settings are defined by processing of a PAC file, set by GPO. WinHTTP proxy settings were not being set from GPO and were undefined. As the Control Panel proxy settings are defined by a PAC file you can not use the standard command below to import them:

netsh winhttp import proxy source=ie

I had to manually download the PAC file, open it and then set the proxy settings:

netsh winhttp set proxy : "

After I had done this, defining the HTTP_PROXY and HTTPS_PROXY environment variables allowed a fresh installation of VcPkg to download the tools and packages.

I will be getting our I.T. department to correctly set the WinHttp proxy settings using GPO.

All 22 comments

I confirm, only I had no error, and the process seemed to hang

@ras0219-msft
and Yes, why boot under Windows? system powershell is still in use

there are some bugs in the system powershell that pwsh-core should fix.
Recently errors with PROXY are becoming more and more common during vcpkg usage, I'd move completely to aria, is there any regression in doing so? (it seems anyway that normal windows commands have problems recently with proxy anyway)

there are some bugs in the system powershell that pwsh-core should fix.

I do not mind, but then you need to isolate the system built-in powershell

"C:\Program Files (x86)\CMake\bin\cmake.exe" "-DCMD=BUILD" "-DPORT=lastools" "-DCURRENT_PORT_DIR=E:/tools/vcpkg/ports/lastools" "-DTARGET_TRIPLET=x64-windows" "-DTARGET_TRIPLET_FILE=E:\tools\vcpkg\triplets\x64-windows.cmake" "-DVCPKG_PLATFORM_TOOLSET=v141" "-DVCPKG_USE_HEAD_VERSION=0" "-DDOWNLOADS=E:/tools/vcpkg/downloads" "-D_VCPKG_NO_DOWNLOADS=0" "-D_VCPKG_DOWNLOAD_TOOL=BUILT_IN" "-DFEATURES=core" "-DALL_FEATURES=" "-DVCPKG_CONCURRENCY=5" "-DPORT_FULL_VERSION=2019-07-10" "-DPORT_VERSION=2019" "-DPORT_CMAKE_VERSION=2019" "-DPORT_DESCRIPTION=LAStools: award-winning software for efficient LiDAR processing (with LASzip)" "-DPORT_HOMEPAGE=https://github.com/LAStools/LAStools" "-DPORT_DEPENDENCIES=" "-DGIT=E:/tools/vcpkg/downloads/MinGit-2.16.2-32-bit/cmd/git.exe" -P "E:/tools/vcpkg/scripts/ports.cmake"

default "-D_VCPKG_DOWNLOAD_TOOL=BUILT_IN"

set _VCPKG_DOWNLOAD_TOOL=ARIA2 ?

IMHO, this is a never-ending story with no happy end. Proxy support as well as file protocol worked in the past but are broken in current versions. The move to WinApi was one regression, the move to aria2 the next one.
See my issues #2928, #3230, #5657.

Before talking about the issue of downloading, it is just plainly annoying that pwsh.exe in the PATH is ignored. Why?

copy pwsh.exe powershell.exe

I noticed that not all ports are running pwsh
probably somewhere in the scripts clearly indicate the name

@ras0219-msft is it ok that vcpkg is still broken when installed behind a proxy?

A clean vcpkg installation on windows fails to download powershell, 7-zip and nuget just at the beginning, when installing your first library.

Subsequent downloads are working (they still often fail for no apparent reason at all) , the first three nope and I have to download them manually from a browser and move them inside the vcpkg/downloads folder.
I still didn't inspect why, but these downloads are done in a different way (broken, it seems), because they are totally not tested for proxy support. Also the fact that proxy support is so weak that usually I prefer to do the "download-only" part on the WSL side is depressing (same pc, same proxy, somehow the linux part is more proxy resilient), so that I don't fear of finding the update stopped because one of the library failed to download (never happened when not using proxy).

Just to let you know, vcpkg on windows is the only program that gives me any problem with "dropped internet connection", so i'd not declare our proxy as guilty. Also, even when vcpkg is failing repeatedly, any browser installed can download the tar.gz with no problem, and as I said also the WSL version can, without any annoyance.

Please fix it. For any enterprise adoption of vcpkg, a proper proxy support is a deal breaker. It's still far from being here.

We have exactly the same issue in our organisation. Having looked at it for a couple of hours this morning and reading all the associated issues and links, I have found that for us it is an I.T. problem more than anything that can be resolved in code.

The link that solved our problem was provided in issue #4729.
https://blogs.technet.microsoft.com/netgeeks/2018/06/19/winhttp-proxy-settings-deployed-by-gpo/

This states that there are two proxy mechanisms in Windows.

  • Internet Settings Control Panel
  • WinHTTP Windows Services

VcPkg is now affected by both.
The former (which requires you to set the 'HTTP_PROXY' and 'HTTPS_PROXY' variables) is used when downloading packages.
The later is used by the WinHTTP API, which VcPkg now uses to download the tools such as PowerShell Core, 7Zip, Nuget etc....

In our organisation the Control Panel proxy settings are defined by processing of a PAC file, set by GPO. WinHTTP proxy settings were not being set from GPO and were undefined. As the Control Panel proxy settings are defined by a PAC file you can not use the standard command below to import them:

netsh winhttp import proxy source=ie

I had to manually download the PAC file, open it and then set the proxy settings:

netsh winhttp set proxy : "

After I had done this, defining the HTTP_PROXY and HTTPS_PROXY environment variables allowed a fresh installation of VcPkg to download the tools and packages.

I will be getting our I.T. department to correctly set the WinHttp proxy settings using GPO.

thanks for your investigation. I'll try to reproduce your solution in our environment and I'll get in touch with our IT dept in case the fix might apply to us also!

~I tried to apply winhttp proxy using netsh.~
~Unfortunately I still have the same problem for the initial PowerShell download:~

WinHttpQueryDataAvailable() failed: 12002

~will continue my investigation, with a very low priority~

edit: a reboot was necessary!

also, if this is a machine configuration which is not possible to dynamically change through the pac file, then I think it's better to avoid setting this up, otherwise when you are not behind the proxy everything is broken. Isn't it better to move those files to another download mechanism, so that winhttp setup is not required? @ras0219-msft

disable antivirus
download the missing file and copy to the destination folder then try again

9372 should fix also this issue. Will report after investigation if it can be closed

@cenit unfortunately, still not working for me.

I pulled the latest changes for vcpkg as shown in #9372 but no luck yet unfortunately, still getting the same error.

C:\Users\felip\vcpkg>.\vcpkg integrate install
Applied user-wide integration for this vcpkg root.

All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.

CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/Users/felip/vcpkg/scripts/buildsystems/vcpkg.cmake"

C:\Users\felip\vcpkg>.\vcpkg install sdl2 curl
Computing installation plan...
A suitable version of cmake was not found (required v3.14.0). Downloading portable cmake v3.14.0...
Downloading cmake...
  https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-win32-x86.zip -> C:\Users\felip\vcpkg\downloads\cmake-3.14.0-win32-x86.zip
Extracting cmake...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
  https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\Users\felip\vcpkg\downloads\7-zip.commandline.18.1.0.nupkg
Extracting 7zip...
A suitable version of nuget was not found (required v4.6.2). Downloading portable nuget v4.6.2...
Downloading nuget...
  https://dist.nuget.org/win-x86-commandline/v4.6.2/nuget.exe -> C:\Users\felip\vcpkg\downloads\nuget.exe
WinHttpQueryDataAvailable() failed: 12002

I am having the same issue while using my workstation beahind the company proxy.
Is there any news about this problem? Is there a workaround?

I had the same problem
My problem was solved by closing Kaspersky Anti-Virus

Had the same issue

.\vcpkg\vcpkg install restclient-cpp

Error :

Computing installation plan...
A suitable version of cmake was not found (required v3.17.2). Downloading portable cmake v3.17.2...
Extracting cmake...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Extracting 7zip...
A suitable version of nuget was not found (required v5.5.1). Downloading portable nuget v5.5.1...
Downloading nuget...
  https://dist.nuget.org/win-x86-commandline/v5.5.1/nuget.exe -> C:\src\vcpkg\vcpkg\downloads\22ea847d-nuget.exe
WinHttpSendRequest() failed: 12002

Getting the same issue: Error listed below:
A suitable version of git was not found (required v2.26.2). Downloading portable git v2.26.2...
Downloading git...
https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-32-bit.7z.exe -> D:vcpkgdownloadsPortableGit-2.26.2-32-bit.7z.exe
WinHttpQueryDataAvailable() failed: 12002

KINDLY HELP ME!

Getting the same issue: Error listed below:
A suitable version of git was not found (required v2.26.2). Downloading portable git v2.26.2...
Downloading git...
https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-32-bit.7z.exe -> D:vcpkgdownloadsPortableGit-2.26.2-32-bit.7z.exe
WinHttpQueryDataAvailable() failed: 12002

KINDLY HELP ME!

@Farjad3253 , what worked for me was:

Manually download that file and place it in D:\vcpkg\downloads\

Manually download that file and place it in D:\vcpkg\downloads\
@rajvijay68, @cenit @sgatto @FrankHB @martin-s @Voskrese
Still getting the following error :

errors.txt.txt

Please help me!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

madkoala picture madkoala  路  3Comments

grandprixgp picture grandprixgp  路  3Comments

F0I0l0I0P picture F0I0l0I0P  路  3Comments

spindensity picture spindensity  路  3Comments