Skip to content

Commit 7e469f3

Browse files
committed
scripts-dev/federation_client.py: Make MatrixConnectionAdapter respect HTTP proxy settings
1 parent 0f3c453 commit 7e469f3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts-dev/federation_client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,21 @@ def get_connection_with_tls_context(
322322
print(
323323
f"Connecting to {host}:{port} with SNI {ssl_server_name}", file=sys.stderr
324324
)
325+
326+
if proxies:
327+
scheme = parsed.scheme
328+
if isinstance(scheme, bytes):
329+
scheme = scheme.decode("utf-8")
330+
331+
proxy_for_scheme = proxies.get(scheme)
332+
if proxy_for_scheme:
333+
return self.proxy_manager_for(proxy_for_scheme).connection_from_host(
334+
host,
335+
port=port,
336+
scheme="https",
337+
pool_kwargs={"server_hostname": ssl_server_name},
338+
)
339+
325340
return self.poolmanager.connection_from_host(
326341
host,
327342
port=port,

0 commit comments

Comments
 (0)