Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Port "Add support for no_proxy and case insensitive env variables" from mainline to dinsic #93

Merged
merged 4 commits into from
Mar 22, 2021

Conversation

anoadragon453
Copy link
Member

This PR is simply porting matrix-org/synapse#9372 to dinsic.

I also had to bring in matrix-org/synapse#8821 and matrix-org/synapse#9084 for this code to work properly - a sign that we should merge mainline into dinsic again soon.

Bubu and others added 3 commits March 19, 2021 15:43
It is expected that the proxy would be on a private IP address so the
configured proxy should be connected to regardless of the IP range
blacklist.
Replaces the `federation_ip_range_blacklist` configuration setting with an
`ip_range_blacklist` setting with wider scope. It now applies to:

* Federation
* Identity servers
* Push notifications
* Checking key validitity for third-party invite events

The old `federation_ip_range_blacklist` setting is still honored if present, but
with reduced scope (it only applies to federation and identity servers).
- 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 [email protected]
…ent instance

This reverts a small change made in
matrix-org/synapse@e08ea43
that switches from using the HS's SimpleHttpClient to creating a new one. There isn't
a point in doing so without providing any arguments, and doing so breaks the way a
test checks that a call was made, so let's change it back.

I plan to port this change back to mainline as well.
@anoadragon453 anoadragon453 merged commit 232b324 into dinsic Mar 22, 2021
@anoadragon453 anoadragon453 deleted the anoa/no_proxy_support branch March 22, 2021 17:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants