Skip to content

Commit

Permalink
Add support for "no_proxy" to specify proxy exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
forderud committed Mar 17, 2016
1 parent ed8c207 commit 454a2f3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Core/Http/ProxyCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ProxyCache : IProxyCache
private const string HostKey = "http_proxy";
private const string UserKey = "http_proxy.user";
private const string PasswordKey = "http_proxy.password";
private const string NoProxy = "no_proxy";

/// <summary>
/// Capture the default System Proxy so that it can be re-used by the IProxyFinder
Expand Down Expand Up @@ -103,6 +104,14 @@ internal WebProxy GetUserConfiguredProxy()
{
webProxy.Credentials = new NetworkCredential(userName, password);
}

var noProxy = _settings.GetConfigValue(NoProxy);
if (!String.IsNullOrEmpty(noProxy))
{
// split comma-separated list of domains
webProxy.BypassList = noProxy.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}

return webProxy;
}

Expand All @@ -120,6 +129,14 @@ internal WebProxy GetUserConfiguredProxy()
webProxy.Credentials = new NetworkCredential(userName: credentials[0], password: credentials[1]);
}
}

var noProxy = _environment.GetEnvironmentVariable(NoProxy);
if (!String.IsNullOrEmpty(noProxy))
{
// split comma-separated list of domains
webProxy.BypassList = noProxy.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}

return webProxy;
}
return null;
Expand Down

0 comments on commit 454a2f3

Please sign in to comment.