summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2016-05-16 13:13:26 +0100
committerMatthew Hodgson <matthew@arasphere.net>2016-05-16 13:13:26 +0100
commit2d98c960ecfe50faae2eaedff45eebe8ba54cf6e (patch)
tree7f7cff56157068180daef95e1994af8d22f107d7 /synapse/http/client.py
parentfix logo (diff)
parentClean up the blacklist/whitelist handling. (diff)
downloadsynapse-2d98c960ecfe50faae2eaedff45eebe8ba54cf6e.tar.xz
Merge pull request #760 from matrix-org/matthew/preview_url_ip_whitelist
add a url_preview_ip_range_whitelist config param
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 902ae7a203..c7fa692435 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -380,13 +380,14 @@ class CaptchaServerHttpClient(SimpleHttpClient):
 class SpiderEndpointFactory(object):
     def __init__(self, hs):
         self.blacklist = hs.config.url_preview_ip_range_blacklist
+        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 +396,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,