-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Re-order proxy precedence. #2018
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
Comments
I've taken a quick look at the code in urllib3 and I can't find any reference to the As for proxy setting precedence, what do you mean by 'interfere with'? We don't override any settings already in the proxy dictionary as we use |
I'll have to write up a sample that triggers this. So far I've got a situation where the env proxy is defined, |
It seems redirects pass through |
It does ignore |
Ah, somehow I though the installation docs were saying to use the github source rather than pip or easy_install. I see now that it says instead to use pip instead of easy_install and then goes on to say where you can get the source. |
Regarding proxy setting precedence, I think In pseudo-code, it'd be something like:
|
To be clear for those who aren't sure, the way @ouroborus' suggestion differs from the current logic is that we take the proxies from the request, then apply proxies from the environment, then finally apply proxies from the I'm open to re-ordering the precedence of the priorities. @sigmavirus24, thoughts? |
Can anyone recall the reasoning behind the current order of precedence? It is extremely odd to me that the order of precedence is contrary to the rest of the library. |
No, and IIRC (I'm on my phone) it's been that way for a while. Looked like an oversight to me. |
Then consider me in favor of the reordering.Sent from my Android device with K-9 Mail. Please excuse my brevity. |
It's been noted that this issue is poorly named. I'm not sure what to rename it or even if it should be now that it has been created. @Lukasa, feel free to rename it if and as you see fit. |
@Lukasa wasn't this already fixed? |
@sigmavirus24 Not that I can see. =) |
This issue causes real headache when using saltstack with pip states and https_proxy set in the environment. A workaround is overwriting your environment variable with saltstacks env_var:
But it is rather messy, therefore I'd appreciate if this bug would be fixed. |
It will be. That's why it's labeled as "Planned". Also note that we've set a milestone for it. Thanks for your interest. |
To quote @nateprewitt from Aug 11, 2016:
|
While investigating this old proxy precedence bug/issue, I came across #6153. That bug is about a behavioral difference when passing The bug was dismissed as expected behavior. As @nateprewitt noted, " To summarize,
Observed behavior: I bring this up here because the behavioral discrepancy between original and redirected requests is strikingly similar to the issue described in #2018 (comment) here back in 2014, which was promptly fixed in #2021. So I'm thinking a similar fix should be made too, when we're addressing precedence issues. |
Session.trust_env = False
turns off the checking of environment variables for options including proxy settings (*_proxy
). Buturllib
picks up and uses these environment proxy settings anyway.requests
should pass thetrust_env
setting on tourllib
. (Although I'm not sure ifurllib
has a similar override.)(Proxy setting precedence should be sorted out here as well. They way it is now, environment proxy settings will interfere with (rather than be over-ridden by) the
proxies
argument inSession.request
orrequests.request
calls and theSession.proxies
config regardless oftrust_env
settings.)The text was updated successfully, but these errors were encountered: