diff --git a/lib/git.ps1 b/lib/git.ps1 index d06aaa64af..b793c4f55b 100644 --- a/lib/git.ps1 +++ b/lib/git.ps1 @@ -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 } diff --git a/lib/install.ps1 b/lib/install.ps1 index c5638c8b5a..393fcea626 100644 --- a/lib/install.ps1 +++ b/lib/install.ps1 @@ -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*") { + $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]) { diff --git a/libexec/scoop-config.ps1 b/libexec/scoop-config.ps1 index c0fb6b39c5..62e337c683 100644 --- a/libexec/scoop-config.ps1 +++ b/libexec/scoop-config.ps1 @@ -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. #