Skip to content
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

trust_env doesn't works #3075

Closed
cartosco opened this issue Jun 12, 2018 · 5 comments
Closed

trust_env doesn't works #3075

cartosco opened this issue Jun 12, 2018 · 5 comments
Labels

Comments

@cartosco
Copy link

Long story short

Passing trust_env=True in ClientSession doesn't works

Expected behaviour

Try to connect to proxy

Actual behaviour

Doesn't connect to proxy

Steps to reproduce

trust_env=True

env Vars setted http_proxy HTTP_PROXY https_proxy and HTTPS_PROXY
client connect directly to endpoint instead to connect with proxy

If I set proxy=http://myproxy.es the client works and try to connect with proxy but with trust_env method doesn't work

@asvetlov
Copy link
Member

What aiohttp.helpers.proxies_from_env() returns on your box?

@cartosco
Copy link
Author

--------- CODE ---------
print (os.environ.get('HTTP_PROXY'))
print(os.environ.get('HTTPS_PROXY'))
helpers = aiohttp.helpers.proxies_from_env()
print(helpers)
print(self._session._trust_env)

--------- OUTPUT ---------
http://myproxy.es
https://myproxy.es
{'http': ProxyInfo(proxy=URL('http://myproxy.es'), proxy_auth=None)}
True

@asvetlov
Copy link
Member

The problem is https://myproxy.es proxy for HTTPS_PROXY env var.
aiohttp doesn't support it.
If you enable logging you'll see "HTTPS proxies %s are not supported, ignoring".
Use http://myproxy.es as the value.

@cartosco
Copy link
Author

ok, this is exactly the problem, thanks for your quick response :-)

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants