File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/ScriptEngine.HostedScript/Library/Http Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public class InternetProxyContext : AutoContext<InternetProxyContext>
2323 private Dictionary < string , IWebProxy > _proxies = new Dictionary < string , IWebProxy > ( ) ;
2424 private const string LINUX_ENV_HTTP = "http_proxy" ;
2525 private const string LINUX_ENV_HTTPS = "https_proxy" ;
26+ private const string LINUX_ENV_NO_PROXY = "no_proxy" ;
2627
2728 private ArrayImpl _bypassProxyOnAddresses ;
2829 private bool _bypassLocal ;
@@ -44,6 +45,14 @@ public InternetProxyContext(bool useDefault)
4445 var httpsEnv = System . Environment . GetEnvironmentVariable ( LINUX_ENV_HTTPS ) ;
4546 _proxies [ Uri . UriSchemeHttps ] = httpsEnv == null ? emptyProxy :
4647 _proxies [ Uri . UriSchemeHttps ] = GetProxyFromEnvironmentVariable ( httpEnv ) ;
48+
49+ var noProxy = System . Environment . GetEnvironmentVariable ( LINUX_ENV_NO_PROXY ) ?? string . Empty ;
50+ var separator = new [ ] { ',' , ' ' } ;
51+ var byPassList = noProxy . Split ( separator , StringSplitOptions . RemoveEmptyEntries ) ;
52+ foreach ( var uri in byPassList )
53+ _bypassProxyOnAddresses . Add ( ValueFactory . Create ( uri ) ) ;
54+ foreach ( var proxy in _proxies . Values . Cast < WebProxy > ( ) )
55+ proxy . BypassList = byPassList ;
4756 }
4857 else
4958 {
You can’t perform that action at this time.
0 commit comments