summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-05-01 12:44:24 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-05-01 12:44:24 +0100
commit792def49288432852fef5059f13184af67843818 (patch)
treeee56557c6afd45e41e3eb8ab9770279e6a42aff1 /synapse/http/client.py
parentMerge pull request #758 from matrix-org/dbkr/fix_password_reset (diff)
downloadsynapse-792def49288432852fef5059f13184af67843818.tar.xz
add a url_preview_ip_range_whitelist config param so we can whitelist the matrix.org IP space
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 902ae7a203..a8e2d8e808 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -380,13 +380,15 @@ class CaptchaServerHttpClient(SimpleHttpClient):
 class SpiderEndpointFactory(object):
     def __init__(self, hs):
         self.blacklist = hs.config.url_preview_ip_range_blacklist
+        if hasattr(hs.config, "url_preview_ip_range_whitelist"):
+            self.whitelist = hs.config.url_preview_ip_range_whitelist
         self.policyForHTTPS = hs.get_http_client_context_factory()
 
     def endpointForURI(self, uri):
         logger.info("Getting endpoint for %s", uri.toBytes())
         if uri.scheme == "http":
             return SpiderEndpoint(
-                reactor, uri.host, uri.port, self.blacklist,
+                reactor, uri.host, uri.port, self.blacklist, self.whitelist,
                 endpoint=TCP4ClientEndpoint,
                 endpoint_kw_args={
                     'timeout': 15
@@ -395,7 +397,7 @@ class SpiderEndpointFactory(object):
         elif uri.scheme == "https":
             tlsPolicy = self.policyForHTTPS.creatorForNetloc(uri.host, uri.port)
             return SpiderEndpoint(
-                reactor, uri.host, uri.port, self.blacklist,
+                reactor, uri.host, uri.port, self.blacklist, self.whitelist,
                 endpoint=SSL4ClientEndpoint,
                 endpoint_kw_args={
                     'sslContextFactory': tlsPolicy,