Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport no_proxy environment variable. #140 #145
Conversation
This comment has been minimized.
This comment has been minimized.
Unless I'm misreading this, this code will require parsing the |
This comment has been minimized.
This comment has been minimized.
Yeah, you're quite right. Would |
This comment has been minimized.
This comment has been minimized.
It's fine to do it in this function. Just do it outside of the inner function (in the same part of the code where |
This comment has been minimized.
This comment has been minimized.
Is there anything else you'd like done on this one? |
This comment has been minimized.
This comment has been minimized.
I'll check now. For future reference: Github doesn't send notifications on new commits to a PR, so it's good to add a comment when making such a change. |
This comment has been minimized.
This comment has been minimized.
Thanks! |
hgiddens commentedAug 7, 2015
Sorry if I've done any dumb stuff here. I tried to find a spec, and the nearest I could find was some ancient info from W3C. I've thus implemented a subset of what other popular libraries support.
no_proxy
contains a list of domain suffixes, separated by commas. The domain suffixes may optionally have leading periods; the commas may optionally have trailing spaces.For example, if
no_proxy=internal.company.com, .other.company.com
, requests tointernal.company.com
,foo.internal.company.com
, andother.company.com
will avoid the proxy. Requests tonotactuallyinternal.company.com
will still go via the proxy.Differences to other implementations:
Domain suffix vs. string suffix
wget and Python's urllib3 avoid the proxy if one of the
no_proxy
hosts is a string suffix of the request host, rather than a domain suffix (with special casing sono_proxy=.foo.example
avoids the proxy for requests tofoo.example
).Ignoring case/spaces
Some implementations ignore all spaces, rather than just
0x20
s following a comma. Some implementations also use case-sensitive domain handling.Port-specific rules
Ruby's stdlib implementation can be made to apply only to specific ports.
Avoiding the proxy for CADR ranges
Python's urllib3 allows you to specify e.g.
no_proxy=internal.company.com,192.168.0.0/16
.Avoiding the proxy for all requests
Ruby and cURL avoid the proxy for all requests if
no_proxy=*
is set.