summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2016-12-12 16:19:54 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2016-12-12 16:32:47 +0100
commitd3bd94805f6ef68e75d8c2e39b8c97ea5ce88286 (patch)
treed297f3abc3c58a1c2bdb23268abb7f56db32daa0 /synapse/http/client.py
parentIPv6 support for endpoint.py (diff)
downloadsynapse-d3bd94805f6ef68e75d8c2e39b8c97ea5ce88286.tar.xz
Fixup for #1689 and #1690
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to '')
-rw-r--r--synapse/http/client.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index c60e3c2ac0..37988716e7 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -25,7 +25,7 @@ from synapse.http.endpoint import SpiderEndpoint
 from canonicaljson import encode_canonical_json
 
 from twisted.internet import defer, reactor, ssl, protocol, task
-from twisted.internet.endpoints import SSL4ClientEndpoint, TCP4ClientEndpoint
+from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS
 from twisted.web.client import (
     BrowserLikeRedirectAgent, ContentDecoderAgent, GzipDecoder, Agent,
     readBody, PartialDownloadError,
@@ -386,13 +386,16 @@ class SpiderEndpointFactory(object):
 
     def endpointForURI(self, uri):
         logger.info("Getting endpoint for %s", uri.toBytes())
-        
+
         if uri.scheme == "http":
             endpoint_factory = HostnameEndpoint
         elif uri.scheme == "https":
             tlsCreator = self.policyForHTTPS.creatorForNetloc(uri.host, uri.port)
+
             def endpoint_factory(reactor, host, port, **kw):
-                return wrapClientTLS(tlsCreator, HostnameEndpoint(reactor, host, port, **kw)
+                return wrapClientTLS(
+                    tlsCreator,
+                    HostnameEndpoint(reactor, host, port, **kw))
         else:
             logger.warn("Can't get endpoint for unrecognised scheme %s", uri.scheme)
             return None
@@ -400,7 +403,7 @@ class SpiderEndpointFactory(object):
             reactor, uri.host, uri.port, self.blacklist, self.whitelist,
             endpoint=endpoint_factory, endpoint_kw_args=dict(timeout=15),
         )
-                                     
+
 
 
 class SpiderHttpClient(SimpleHttpClient):