Handle proxy variables#2789
Merged
kairoaraujo merged 6 commits intotheupdateframework:developfrom Mar 4, 2025
Merged
Conversation
2ccefa3 to
f396735
Compare
This was referenced Feb 14, 2025
3656375 to
be9c0b3
Compare
jku
commented
Feb 15, 2025
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
| from urllib.request import getproxies |
Member
Author
There was a problem hiding this comment.
we could implement this method ourselves as well but I tried to keep this minimal
Closed
urllib3 does not handle this but we do want to support proxy users. The environment variable handling is slightly simplified from the requests implementation. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This does not actually test using tuf through proxies: it only tests that ProxyEnvironment creates the ProxyManagers that we expect to be created based on the proxy environment variables. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Add support for leading dots in no_proxy and "*" as a no_proxy value. Both are supported in requests and based on https://about.gitlab.com/blog/2021/01/27/we-need-to-talk-no-proxy/ both are somewhat common. Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
e2b2aec to
98fcd71
Compare
Member
Author
|
rebased on develop after #2773 merged |
Contributor
|
@jku, this is an impressive work! Thank you for dedicating time on it. |
Member
Author
|
I think the |
kairoaraujo
approved these changes
Mar 4, 2025
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.
This PR handles proxy variables (notably
http_proxy,https_proxy,no_proxy,all_proxy) when using Urllib3Fetcher:ProxyEnvironmentis used like urllib3PoolManager: it has the samerequest()method (we could easily implement the whole RequestMethods mixin but since we only use the one method, that didn't seem useful)ProxyEnvironmentkeeps track of typically 1-3 PoolManagers [non-proxied, http-proxied, https-proxied] and chooses between those based on the requested url and the environment variablesI did not want to implement this as I think this component should be in urllib3 but it's not a lot of code (maybe 50 lines of actual code) so I can live with it. As far as I know this puts python-tuf back to feature parity with v5.1: this was the only feature that I know of that we lost with the move from
requeststourllib3only.Fixes #2787