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

Commit

Permalink
Clarify supported proxy connection string; clean up docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Mar 22, 2021
1 parent ed1b12a commit 0c5a5b9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions synapse/http/proxyagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,16 @@ def request(self, method, uri, headers=None, bodyProducer=None):
)


def _http_proxy_endpoint(proxy, reactor, **kwargs):
def _http_proxy_endpoint(proxy: Optional[bytes], reactor, **kwargs):
"""Parses an http proxy setting and returns an endpoint for the proxy
Args:
proxy (bytes|None): the proxy setting
proxy: the proxy setting in the form: [<username>:<password>@]<host>[:<port>]
Note that compared to other apps, this function currently lacks support
for specifying a protocol schema (i.e. protocol://...).
reactor: reactor to be used to connect to the proxy
kwargs: other args to be passed to HostnameEndpoint
Returns:
Expand All @@ -257,7 +261,7 @@ def _http_proxy_endpoint(proxy, reactor, **kwargs):
if proxy is None:
return None

# Parse the connection string, supporting the form: [<username>:<password>@]<host>[:port]
# Parse the connection string
host, port = parse_host_port(proxy, default_port=1080)
return HostnameEndpoint(reactor, host, port, **kwargs)

Expand Down

0 comments on commit 0c5a5b9

Please sign in to comment.