-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch back to using 'Invoke-WebRequest' instead of 'curl'
* Closes #91.
- Loading branch information
Showing
1 changed file
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# | ||
# Fido v1.56 - Feature ISO Downloader, for retail Windows images and UEFI Shell | ||
# Fido v1.57 - Feature ISO Downloader, for retail Windows images and UEFI Shell | ||
# Copyright © 2019-2024 Pete Batard <[email protected]> | ||
# Command line support: Copyright © 2021 flx5 | ||
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter | ||
|
@@ -519,8 +519,8 @@ function Check-Locale | |
# Also: "Hi Microsoft. You sure have A LOT OF RESOURCES TO WASTE to have assigned folks of yours to cripple scripts | ||
# that merely exist because you have chosen to make the user experience from your download website utterly subpar. | ||
# And while I am glad senpai noticed me (UwU), I feel compelled to ask: Don't you guys have better things to do?" | ||
curl -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 $url | Out-Null | ||
curl -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null | ||
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 $url | Out-Null | ||
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null | ||
} catch { | ||
# Of course PowerShell 7 had to BREAK $_.Exception.Status on timeouts... | ||
if ($_.Exception.Status -eq "Timeout" -or $_.Exception.GetType().Name -eq "TaskCanceledException") { | ||
|
@@ -580,7 +580,7 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition) | |
Write-Host Querying $url | ||
} | ||
try { | ||
curl -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null | ||
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null | ||
} catch { | ||
Error($_.Exception.Message) | ||
return @() | ||
|
@@ -599,7 +599,7 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition) | |
|
||
$script:SelectedIndex = 0 | ||
try { | ||
$r = curl -Method Post -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -SessionVariable "Session" $url | ||
$r = Invoke-WebRequest -Method Post -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -SessionVariable "Session" $url | ||
if ($r -match "errorModalMessage") { | ||
Throw-Error -Req $r -Alt "Could not retrieve languages from server" | ||
} | ||
|
@@ -689,7 +689,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease | |
$Is64 = [Environment]::Is64BitOperatingSystem | ||
# Must add a referer for this request, else Microsoft's servers will deny it | ||
$ref = "https://www.microsoft.com/software-download/windows11" | ||
$r = curl -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -WebSession $Session $url | ||
$r = Invoke-WebRequest -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -WebSession $Session $url | ||
if ($r -match "errorModalMessage") { | ||
$Alt = [regex]::Match($r.Content, '<p id="errorModalMessage">(.+?)<\/p>').Groups[1].Value -replace "<[^>]+>" -replace "\s+", " " -replace "\?\?\?", "-" | ||
$Alt = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Alt) | ||
|
@@ -742,7 +742,7 @@ function Process-Download-Link([string]$Url) | |
$pattern = '.*\/(.*\.iso).*' | ||
$File = [regex]::Match($Url, $pattern).Groups[1].Value | ||
# PowerShell implicit conversions are iffy, so we need to force them... | ||
$str_size = (curl -UseBasicParsing -TimeoutSec $DefaultTimeout -Uri $Url -Method Head).Headers.'Content-Length' | ||
$str_size = (Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -Uri $Url -Method Head).Headers.'Content-Length' | ||
$tmp_size = [uint64]::Parse($str_size) | ||
$Size = Size-To-Human-Readable $tmp_size | ||
Write-Host "Downloading '$File' ($Size)..." | ||
|
@@ -1075,8 +1075,8 @@ exit $ExitCode | |
# SIG # Begin signature block | ||
# MIIkWAYJKoZIhvcNAQcCoIIkSTCCJEUCAQExDzANBglghkgBZQMEAgEFADB5Bgor | ||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG | ||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCD+x1KfwoalW3t | ||
# +j1Qn14VTLu8yO8vHTqfh8WnOWfDH6CCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU | ||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB6/hZgyGy5PCvt | ||
# gCtQT/nZSZCBsJLelhii59nr9meeYqCCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU | ||
# jTanyYqJ1pQWMA0GCSqGSIb3DQEBDAUAMHsxCzAJBgNVBAYTAkdCMRswGQYDVQQI | ||
# DBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoM | ||
# EUNvbW9kbyBDQSBMaW1pdGVkMSEwHwYDVQQDDBhBQUEgQ2VydGlmaWNhdGUgU2Vy | ||
|
@@ -1179,22 +1179,22 @@ exit $ExitCode | |
# aWMgQ29kZSBTaWduaW5nIENBIEVWIFIzNgIRAL+xUAG79ZLUlip3l+pzb6MwDQYJ | ||
# YIZIAWUDBAIBBQCgfDAQBgorBgEEAYI3AgEMMQIwADAZBgkqhkiG9w0BCQMxDAYK | ||
# K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rFLCRNZuk7E= | ||
# DQEJAzENBgsqhkiG9w0BCRABBDAcBgkqhkiG9w0BCQUxDxcNMjQwNjE4MTEwNzQ1 | ||
# WjAvBgkqhkiG9w0BCQQxIgQgaLj4rStyAc4gYIJwBDnf1sEWzST3OsOyweYfm5EZ | ||
# XRswNwYLKoZIhvcNAQkQAi8xKDAmMCQwIgQgxHTOdgB9AjlODaXk3nwUxoD54oIB | ||
# PP72U+9dtx/fYfgwCwYJKoZIhvcNAQEBBIIBAIeZ3ykedA8RCnxesyKjJCB1j97D | ||
# 4CzvrQzrWlYg+D/A/4QuYXiCirn0q2ONq61EmH6c/zqC4vRwsGfVGFkQqb9GeC0e | ||
# JAxqubqBcqdN3aTGdjEkv7BQmxi3OLjcTgS0nsQrkPQD46YOX2Mtx2pt8LqsRKyi | ||
# bhhN6WG40hrUnOQFts6pcL6PhFSth7xMh6h/LW9x20R2HBpzvRi8xmK80H7NPH4v | ||
# optllo3Cu6xzp1RSDcsbaCx7YopMjIJbqIQf11YMvE52beHFZnZPz1tTPZaNqzvb | ||
# Ln1K6LDZP6Zpw9OUvDR2UIRCBCLkw/CYWFx75OpbQgNBoDnZKsdjj1x5WgI= | ||
# SIG # End signature block |