Skip to content

[WIP] bpo-24177: Add env var proxy support to http.client #11729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

demianbrecht
Copy link

@demianbrecht demianbrecht commented Feb 2, 2019

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 and all_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:

c = HTTPConnection('example.com', use_proxy_from_environ=True)
c.set_tunnel('example.com')
c.connect()

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

This commit 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 and all_proxy.
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 6, 2025

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants