[WIP] bpo-24177: Add env var proxy support to http.client #11729
+54
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR begins the work for adding environment variable proxy support to http.client. It is intended to be modeled after curl with support for
http_proxy
,https_proxy
,no_proxy
andall_proxy
.So far, I've tested proxy support through squid (HTTP only) under the following cases:
c = HTTPConnection(..., use_proxy_from_environ=True); c.request(...)
c = HTTPConnection(..., use_proxy_from_environ=True); c.connect(); c.request(...)
c = HTTPConnection(..., use_proxy_from_environ=True); c.set_tunnel(...); c.request(...)
c = HTTPConnection(..., use_proxy_from_environ=True); c.set_tunnel(...); c.connect(); c.request(...);
Admittedly, it is a little odd when using an environment proxy and then setting a tunnel:
There's a bunch of work to be done yet as well as tests being written, but I thought I'd at least get this PR up to start a discussion about it. If we think it's a bad idea for any reason then I'd prefer to not sink a ton more time into it :)
@bitdancer, @vadmium thoughts? Anyone else involved with http related stuff these days?
https://bugs.python.org/issue24177