Skip to content

Commit

Permalink
Allow Bypass list to be passed into the proxy
Browse files Browse the repository at this point in the history
Required for actions/setup-dotnet#71. Agents can set proxy settings for their runs which include addresses which should not go through the proxy. This script doesn't allow that value to be specified for windows. In the shell script this is handled by wget and curl both honoring the environment variables https_proxy and no_proxy.
  • Loading branch information
bekir-ozturk authored Jul 29, 2020
2 parents 52f14de + 706116e commit ca03088
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dotnet-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
.PARAMETER ProxyUseDefaultCredentials
Default: false
Use default credentials, when using proxy address.
.PARAMETER ProxyBypassList
If set with ProxyAddress, will provide the list of comma separated urls that will bypass the proxy
.PARAMETER SkipNonVersionedFiles
Default: false
Skips installing non-versioned files if they already exist, such as dotnet.exe.
Expand Down Expand Up @@ -96,6 +98,7 @@ param(
[string]$FeedCredential,
[string]$ProxyAddress,
[switch]$ProxyUseDefaultCredentials,
[string[]]$ProxyBypassList,
[switch]$SkipNonVersionedFiles,
[switch]$NoCdn
)
Expand Down Expand Up @@ -253,7 +256,11 @@ function GetHTTPResponse([Uri] $Uri)

if($ProxyAddress) {
$HttpClientHandler = New-Object System.Net.Http.HttpClientHandler
$HttpClientHandler.Proxy = New-Object System.Net.WebProxy -Property @{Address=$ProxyAddress;UseDefaultCredentials=$ProxyUseDefaultCredentials}
$HttpClientHandler.Proxy = New-Object System.Net.WebProxy -Property @{
Address=$ProxyAddress;
UseDefaultCredentials=$ProxyUseDefaultCredentials;
BypassList = $ProxyBypassList;
}
$HttpClient = New-Object System.Net.Http.HttpClient -ArgumentList $HttpClientHandler
}
else {
Expand Down

0 comments on commit ca03088

Please sign in to comment.