Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ function Invoke-Git {
)

$proxy = get_config PROXY
$no_proxy = get_config NO_PROXY
$git = Get-HelperPath -Helper Git

if ($WorkingDirectory) {
Expand All @@ -246,11 +247,15 @@ function Invoke-Git {
$j = Start-Job -ScriptBlock {
# convert proxy setting for git
$proxy = $using:proxy
$no_proxy = $using:no_proxy
if ($proxy -and $proxy.StartsWith('currentuser@')) {
$proxy = $proxy.Replace('currentuser@', ':@')
}
$env:HTTPS_PROXY = $proxy
$env:HTTP_PROXY = $proxy
if ($no_proxy) {
$env:NO_PROXY = $no_proxy
}
& $using:git @using:ArgumentList
}
$o = $j | Receive-Job -Wait -AutoRemoveJob
Expand Down
5 changes: 5 additions & 0 deletions lib/download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ function Get-UserAgent() {
function setup_proxy() {
# note: '@' and ':' in password must be escaped, e.g. 'p@ssword' -> p\@ssword'
$proxy = get_config PROXY
$no_proxy = get_config NO_PROXY
if (!$proxy) {
return
}
Expand All @@ -572,6 +573,10 @@ function setup_proxy() {
$username, $password = $credentials -split '(?<!\\):' | ForEach-Object { $_ -replace '\\([@:])', '$1' }
[net.webrequest]::defaultwebproxy.credentials = New-Object net.networkcredential($username, $password)
}
if ($no_proxy) {
$bypass_list = $no_proxy -split "\s*,\s*"
[net.webrequest]::defaultwebproxy.BypassList = $bypass_list
}
} catch {
warn "Failed to use proxy '$proxy': $($_.exception.message)"
}
Expand Down