Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/git.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function git_proxy_cmd {
$proxy = get_config 'proxy'
$no_proxy = get_config 'no_proxy'
$cmd = "git $($args | ForEach-Object { "$_ " })"
if($proxy -and $proxy -ne 'none') {
$cmd = "SET HTTPS_PROXY=$proxy&&SET HTTP_PROXY=$proxy&&$cmd"
$cmd = "SET HTTPS_PROXY=$proxy&&SET HTTP_PROXY=$proxy&&SET NO_PROXY=$no_proxy&&$cmd"
}
& "$env:COMSPEC" /c $cmd
}
Expand Down
15 changes: 8 additions & 7 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,19 @@ function dl_with_cache_aria2($app, $version, $manifest, $architecture, $dir, $co

# download with filesize and progress indicator
function dl($url, $to, $cookies, $progress) {
$no_proxy = get_config 'no_proxy'

$reqUrl = ($url -split "#")[0]
$wreq = [net.webrequest]::create($reqUrl)
if($wreq -is [net.httpwebrequest]) {
$wreq.useragent = Get-UserAgent
if (-not ($url -imatch "sourceforge\.net" -or $url -imatch "portableapps\.com")) {
$wreq.referer = strip_filename $url
}
if($cookies) {
$wreq.headers.add('Cookie', (cookie_header $cookies))

if($no_proxy) {
if($reqUrl -like "*$no_proxy*") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the matching should be improved. having the url example.org and NO_PROXY= 192.168.0.1,localhost,www.example.org would lead to a match but should not match. also NO_PROXY should also support wildcards *,example.org

$wreq.proxy = $null
Write-Host "Removing proxy for installation from url: $url"
}
}


$wres = $wreq.getresponse()
$total = $wres.ContentLength
if($total -eq -1 -and $wreq -is [net.ftpwebrequest]) {
Expand Down
1 change: 1 addition & 0 deletions libexec/scoop-config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# --------
#
# proxy: [username:password@]host:port
# no_proxy: host
#
# By default, Scoop will use the proxy settings from Internet Options, but with anonymous authentication.
#
Expand Down