From b0f2b75a2b22ae62eb2ad2ebd505d6c33520b448 Mon Sep 17 00:00:00 2001 From: Jim McGrath Date: Thu, 22 Feb 2018 15:19:14 -0600 Subject: use TLS 1.2 for downloads --- scripts/VcpkgPowershellUtils.ps1 | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index b73361fd1..0cad383d0 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -1,3 +1,4 @@ +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName) { return [bool](Get-Module -ListAvailable -Name $moduleName) -- cgit v1.2.3 From ce53ea00118154f240e7b5cb1856fd85b45dd216 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 22 Feb 2018 17:56:55 -0800 Subject: TLS fix --- scripts/VcpkgPowershellUtils.ps1 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 0cad383d0..d4296857e 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -1,4 +1,3 @@ -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName) { return [bool](Get-Module -ListAvailable -Name $moduleName) @@ -121,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)) { -- cgit v1.2.3