Skip to content

Commit 565d31b

Browse files
committed
Add Set-NetSecurityProtocolType
1 parent 6e8fee5 commit 565d31b

File tree

7 files changed

+45
-0
lines changed

7 files changed

+45
-0
lines changed

extension/BuildPhpExtension/BuildPhpExtension.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
'Invoke-CleanupTempFiles',
100100
'Invoke-Tests',
101101
'Set-GAGroup',
102+
'Set-NetSecurityProtocolType',
102103

103104
# Public functions
104105
'Invoke-PhpBuildExtension'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Function Set-NetSecurityProtocolType {
2+
<#
3+
.Synopsis
4+
Configure the SecurityProtocol of the Net.ServicePointManager.
5+
#>
6+
[OutputType()]
7+
param (
8+
)
9+
begin {
10+
}
11+
process {
12+
try {
13+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + [Net.SecurityProtocolType]::Tls11 + [Net.SecurityProtocolType]::Tls
14+
} catch {
15+
Write-Debug '[Net.ServicePointManager] or [Net.SecurityProtocolType] not found in current environment'
16+
}
17+
}
18+
end {
19+
}
20+
}

extension/BuildPhpExtension/public/Invoke-PhpBuildExtension.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function Invoke-PhpBuildExtension {
3838
}
3939
process {
4040
Set-StrictMode -Off
41+
Set-NetSecurityProtocolType
4142
$VsData = (Get-VsVersion -PhpVersion $PhpVersion)
4243
if($null -eq $VsData.vs) {
4344
throw "PHP version $PhpVersion is not supported."

php/BuildPhp/BuildPhp.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'Get-TestsList'
7575
'Get-VsVersionHelper',
7676
'Get-VsVersion',
77+
'Set-NetSecurityProtocolType',
7778
'Set-PhpIniForTests'
7879

7980
# Public functions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Function Set-NetSecurityProtocolType {
2+
<#
3+
.Synopsis
4+
Configure the SecurityProtocol of the Net.ServicePointManager.
5+
#>
6+
[OutputType()]
7+
param (
8+
)
9+
begin {
10+
}
11+
process {
12+
try {
13+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + [Net.SecurityProtocolType]::Tls11 + [Net.SecurityProtocolType]::Tls
14+
} catch {
15+
Write-Debug '[Net.ServicePointManager] or [Net.SecurityProtocolType] not found in current environment'
16+
}
17+
}
18+
end {
19+
}
20+
}

php/BuildPhp/public/Invoke-PhpBuild.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function Invoke-PhpBuild {
2727
begin {
2828
}
2929
process {
30+
Set-NetSecurityProtocolType
3031
$VsConfig = (Get-VsVersion -PhpVersion $PhpVersion)
3132
if($null -eq $VsConfig.vs) {
3233
throw "PHP version $PhpVersion is not supported."

php/BuildPhp/public/Invoke-PhpTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function Invoke-PhpTests {
3232
begin {
3333
}
3434
process {
35+
Set-NetSecurityProtocolType
3536
$VsVersion = (Get-VsVersion -PhpVersion $PhpVersion)
3637
if($null -eq $VsVersion) {
3738
throw "PHP version $PhpVersion is not supported."

0 commit comments

Comments
 (0)