Skip to content

Commit

Permalink
Ignore SSL certificate errors (#109)
Browse files Browse the repository at this point in the history
Signed-off-by: 迷渡 <[email protected]>
  • Loading branch information
justjavac authored Jun 7, 2022
1 parent 2d86469 commit 347634f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ if (!(Test-Path $BinDir)) {
New-Item $BinDir -ItemType Directory | Out-Null
}

# Ignore SSL certificate errors
# https://stackoverflow.com/questions/11696944/powershell-v3-invoke-webrequest-https-error
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

Invoke-WebRequest $DvmUri -OutFile $DvmZip -UseBasicParsing

if (Get-Command Expand-Archive -ErrorAction SilentlyContinue) {
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi

if [ "$1" = "" ]; then
cd "$dvm_bin_dir"
curl --fail --location --progress-bar --output "$exe.zip" "$dvm_uri"
curl --fail --location --progress-bar -k --output "$exe.zip" "$dvm_uri"
unzip -o "$exe.zip"
rm "$exe.zip"
else
Expand Down

0 comments on commit 347634f

Please sign in to comment.