chocolatey-packages
chocolatey-packages copied to clipboard
update pkgs passing custom headers via custom Net.WebClient object
Deprecate custom WebClient code
Currently, 29 packages are passing referer headers like:
https://github.com/dtgm/chocolatey-packages/blob/master/automatic/nirlauncher/tools/chocolateyInstall.ps1#L13-L16
$referer = "http://launcher.nirsoft.net/download.html"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Referer", $referer)
$wc.DownloadFile($url, $zipFile)
Update to Chocolatey header method
pass custom headers via hashtable
https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1#L17-L24
function Get-WebFile {
param(
$url = '', #(Read-Host "The URL to download"),
$fileName = $null,
$userAgent = 'chocolatey command line',
[switch]$Passthru,
[switch]$quiet,
[hashtable] $options = @{Headers=@{}}
affected packages
$ grep -li 'headers.add' */tools/*.ps1
chromepass/tools/chocolateyInstall.ps1
datacrow/tools/Get-UrlFromFosshub.ps1
ddu/tools/chocolateyInstall.ps1
dialupass/tools/chocolateyInstall.ps1
iepv.install/tools/chocolateyInstall.ps1
iepv.portable/tools/chocolateyInstall.ps1
irfanview/tools/Get-UrlFromFosshub.ps1
lsasecretsdump/tools/chocolateyInstall.ps1
lsasecretsview/tools/chocolateyInstall.ps1
mailpv.install/tools/chocolateyInstall.ps1
mailpv.portable/tools/chocolateyInstall.ps1
mspass.install/tools/chocolateyInstall.ps1
mspass.portable/tools/chocolateyInstall.ps1
netpass.install/tools/chocolateyInstall.ps1
netpass.portable/tools/chocolateyInstall.ps1
nirlauncher/tools/chocolateyInstall.ps1
operapassview/tools/chocolateyInstall.ps1
passwordfox/tools/chocolateyInstall.ps1
pspv/tools/chocolateyInstall.ps1
pstpassword.install/tools/chocolateyInstall.ps1
pstpassword.portable/tools/chocolateyInstall.ps1
rdpv/tools/chocolateyInstall.ps1
routerpassview/tools/chocolateyInstall.ps1
sniffpass.portable/tools/chocolateyInstall.ps1
speedfan/tools/chocolateyInstall.ps1
vncpassview/tools/chocolateyInstall.ps1
webbrowserpassview.install/tools/chocolateyInstall.ps1
webbrowserpassview.portable/tools/chocolateyInstall.ps1
wirelesskeyview/tools/chocolateyInstall.ps1
As soon as these are pushed, they will need 0.9.10+ version of Chocolatey to continue working for folks. What we can do are two things. Set up an extension these can depend on, or set a choco dependency on a particular version once it is released.
do you have stats on what versions of chocolatey users are using? that may give a good idea about which course would be better.
I think we will want to add an extension. I will work on this bit, because I want it to automatically remove itself on 0.9.10.