mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Added Service Point Manager call to force Tls12. (#6310)
Calls [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 during bootstrap to download PowerShell core to avoid an error.
This commit is contained in:
1 parent
d623c9f10c
commit
489f8336b1
1 file changed
+8
@@ -91,6 +91,11 @@ $architecture = if (-not $IsWinEnv) {
|
||||
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
|
||||
New-Item -ItemType Directory -Path $tempDir -Force > $null
|
||||
try {
|
||||
# Setting Tls to 12 to prevent the Invoke-WebRequest : The request was
|
||||
# aborted: Could not create SSL/TLS secure channel. error.
|
||||
$originalValue = [Net.ServicePointManager]::SecurityProtocol
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
if ($Daily) {
|
||||
if (-not (Get-Module -Name PackageManagement -ListAvailable)) {
|
||||
throw "PackageManagement module is required to install daily PowerShell Core."
|
||||
@@ -227,5 +232,8 @@ try {
|
||||
Write-Host "Please restart pwsh" -ForegroundColor Magenta
|
||||
}
|
||||
} finally {
|
||||
# Restore original value
|
||||
[Net.ServicePointManager]::SecurityProtocol = $originalValue
|
||||
|
||||
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Reference in new issue
Block a user