summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-01-14 15:29:29 +0000
committerErik Johnston <erik@matrix.org>2021-01-14 15:29:29 +0000
commit43dc6371362a8ad843de60db36baf5e79c5a7758 (patch)
treef19b08292880d4f9705e5957ff7551840017bd2a /synapse/http/client.py
parentMerge remote-tracking branch 'origin/develop' into matrix-org-hotfixes (diff)
parentAdd background update for add chain cover index (#9029) (diff)
downloadsynapse-43dc6371362a8ad843de60db36baf5e79c5a7758.tar.xz
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py

index 29f40ddf5f..dc4b81ca60 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py
@@ -32,7 +32,7 @@ from typing import ( import treq from canonicaljson import encode_canonical_json -from netaddr import IPAddress, IPSet +from netaddr import AddrFormatError, IPAddress, IPSet from prometheus_client import Counter from zope.interface import implementer, provider @@ -261,16 +261,16 @@ class BlacklistingAgentWrapper(Agent): try: ip_address = IPAddress(h.hostname) - + except AddrFormatError: + # Not an IP + pass + else: if check_against_blacklist( ip_address, self._ip_whitelist, self._ip_blacklist ): logger.info("Blocking access to %s due to blacklist" % (ip_address,)) e = SynapseError(403, "IP address blocked by IP blacklist entry") return defer.fail(Failure(e)) - except Exception: - # Not an IP - pass return self._agent.request( method, uri, headers=headers, bodyProducer=bodyProducer @@ -341,6 +341,7 @@ class SimpleHttpClient: self.agent = ProxyAgent( self.reactor, + hs.get_reactor(), connectTimeout=15, contextFactory=self.hs.get_http_client_context_factory(), pool=pool,