Skip to content

Commit

Permalink
TLS fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkaratarakis committed Feb 23, 2018
1 parent b0f2b75 commit ce53ea0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/VcpkgPowershellUtils.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName)
{
return [bool](Get-Module -ListAvailable -Name $moduleName)
Expand Down Expand Up @@ -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))
{
Expand Down

0 comments on commit ce53ea0

Please sign in to comment.