Merge pull request #2863 from mcgoo/vswhere_github_tls_negotiation

use TLS 1.2 for downloads
This commit is contained in:
Alexander Karatarakis 2018-02-22 18:02:24 -08:00 committed by GitHub
commit 3b636f8d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,11 +120,26 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url,
return
}
if ($url -match "github")
{
if ([System.Enum]::IsDefined([Net.SecurityProtocolType], "Tls12"))
{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
else
{
Write-Warning "Github has dropped support for TLS versions prior to 1.2, which is not available on your system"
Write-Warning "Please manually download $url to $downloadPath"
throw "Download failed"
}
}
vcpkgCreateParentDirectoryIfNotExists $downloadPath
$downloadPartPath = "$downloadPath.part"
vcpkgRemoveItem $downloadPartPath
$wc = New-Object System.Net.WebClient
if (!$wc.Proxy.IsBypassed($url))
{