Consistent handling of HTTP/S proxy environment variables#2079
Open
davidwegs wants to merge 2 commits intoapache:trunkfrom
Open
Consistent handling of HTTP/S proxy environment variables#2079davidwegs wants to merge 2 commits intoapache:trunkfrom
davidwegs wants to merge 2 commits intoapache:trunkfrom
Conversation
…m handling through Requests library
tisonkun
reviewed
Jan 27, 2026
Comment on lines
-107
to
-116
| proxy_url = "http://127.0.0.2:3128" | ||
| os.environ["http_proxy"] = proxy_url | ||
| conn = LibcloudConnection(host="localhost", port=80) | ||
| self.assertEqual(conn.proxy_scheme, "http") | ||
| self.assertEqual(conn.proxy_host, "127.0.0.2") | ||
| self.assertEqual(conn.proxy_port, 3128) | ||
| self.assertEqual( | ||
| conn.session.proxies, | ||
| {"http": "http://127.0.0.2:3128", "https": "http://127.0.0.2:3128"}, | ||
| ) |
Member
There was a problem hiding this comment.
Can we verify the underneath library still hold the proxy settings?
Author
There was a problem hiding this comment.
Just added a separate unit test for this. I can't verify it in this one because the Requests library checks the proxy env variables when processing a request not when creating a Session.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #2079 +/- ##
==========================================
- Coverage 83.39% 83.36% -0.03%
==========================================
Files 353 353
Lines 81696 81906 +210
Branches 8634 9007 +373
==========================================
+ Hits 68123 68276 +153
- Misses 10750 10800 +50
- Partials 2823 2830 +7
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consistent handling of HTTP/S proxy environment variables
Description
This PR provides consistent handling of the
http_proxy,https_proxy, andno_proxyenvironment variables in line with the behavior of the Requests python library. Previouslyno_proxywasn't being respected (#2077).This is done by removing explicit handling of the
http_proxyandhttps_proxyenv variables in favor of downstream handling through the Requests library. Explicitly provided proxy settings through theproxy_urlargument to the connection class and through theset_http_proxymethod are still supported and still take precedence over the environment variables.Status
done, ready for review
Checklist (tick everything that applies)