aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2018-02-22 17:56:55 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2018-02-22 17:56:55 -0800
commitce53ea00118154f240e7b5cb1856fd85b45dd216 (patch)
tree1452357ade4a0f4af007ce4ec49a7a89e3406e56 /scripts
parentb0f2b75a2b22ae62eb2ad2ebd505d6c33520b448 (diff)
downloadvcpkg-ce53ea00118154f240e7b5cb1856fd85b45dd216.tar.gz
vcpkg-ce53ea00118154f240e7b5cb1856fd85b45dd216.zip
TLS fix
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VcpkgPowershellUtils.ps116
1 files changed, 15 insertions, 1 deletions
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))
{