-
- Downloads
Add support for no_proxy and case insensitive env variables (#9372)
### Changes proposed in this PR - Add support for the `no_proxy` and `NO_PROXY` environment variables - Internally rely on urllib's [`proxy_bypass_environment`](https://github.com/python/cpython/blob/bdb941be423bde8b02a5695ccf51c303d6204bed/Lib/urllib/request.py#L2519) - Extract env variables using urllib's `getproxies`/[`getproxies_environment`](https://github.com/python/cpython/blob/bdb941be423bde8b02a5695ccf51c303d6204bed/Lib/urllib/request.py#L2488 ) which supports lowercase + uppercase, preferring lowercase, except for `HTTP_PROXY` in a CGI environment This does contain behaviour changes for consumers so making sure these are called out: - `no_proxy`/`NO_PROXY` is now respected - lowercase `https_proxy` is now allowed and taken over `HTTPS_PROXY` Related to #9306 which also uses `ProxyAgent` Signed-off-by:Timothy Leung <tim95@hotmail.co.uk>
Showing
- changelog.d/9372.feature 1 addition, 0 deletionschangelog.d/9372.feature
- synapse/http/client.py 4 additions, 6 deletionssynapse/http/client.py
- synapse/http/proxyagent.py 33 additions, 4 deletionssynapse/http/proxyagent.py
- synapse/rest/media/v1/preview_url_resource.py 1 addition, 2 deletionssynapse/rest/media/v1/preview_url_resource.py
- synapse/server.py 2 additions, 8 deletionssynapse/server.py
- tests/http/test_proxyagent.py 73 additions, 44 deletionstests/http/test_proxyagent.py
Loading
Please register or sign in to comment