Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
parent
9f07f4c559
commit
d3bd94805f
|
@ -25,7 +25,7 @@ from synapse.http.endpoint import SpiderEndpoint
|
||||||
from canonicaljson import encode_canonical_json
|
from canonicaljson import encode_canonical_json
|
||||||
|
|
||||||
from twisted.internet import defer, reactor, ssl, protocol, task
|
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 (
|
from twisted.web.client import (
|
||||||
BrowserLikeRedirectAgent, ContentDecoderAgent, GzipDecoder, Agent,
|
BrowserLikeRedirectAgent, ContentDecoderAgent, GzipDecoder, Agent,
|
||||||
readBody, PartialDownloadError,
|
readBody, PartialDownloadError,
|
||||||
|
@ -391,8 +391,11 @@ class SpiderEndpointFactory(object):
|
||||||
endpoint_factory = HostnameEndpoint
|
endpoint_factory = HostnameEndpoint
|
||||||
elif uri.scheme == "https":
|
elif uri.scheme == "https":
|
||||||
tlsCreator = self.policyForHTTPS.creatorForNetloc(uri.host, uri.port)
|
tlsCreator = self.policyForHTTPS.creatorForNetloc(uri.host, uri.port)
|
||||||
|
|
||||||
def endpoint_factory(reactor, host, port, **kw):
|
def endpoint_factory(reactor, host, port, **kw):
|
||||||
return wrapClientTLS(tlsCreator, HostnameEndpoint(reactor, host, port, **kw)
|
return wrapClientTLS(
|
||||||
|
tlsCreator,
|
||||||
|
HostnameEndpoint(reactor, host, port, **kw))
|
||||||
else:
|
else:
|
||||||
logger.warn("Can't get endpoint for unrecognised scheme %s", uri.scheme)
|
logger.warn("Can't get endpoint for unrecognised scheme %s", uri.scheme)
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -61,8 +61,10 @@ def matrix_federation_endpoint(reactor, destination, ssl_context_factory=None,
|
||||||
transport_endpoint = HostnameEndpoint
|
transport_endpoint = HostnameEndpoint
|
||||||
default_port = 8008
|
default_port = 8008
|
||||||
else:
|
else:
|
||||||
def transport_endpoint(reactor, host, port):
|
def transport_endpoint(reactor, host, port, timeout):
|
||||||
return wrapClientTLS(ssl_context_factory, HostnameEndpoint(reactor, host, port))
|
return wrapClientTLS(
|
||||||
|
ssl_context_factory,
|
||||||
|
HostnameEndpoint(reactor, host, port, timeout=timeout))
|
||||||
default_port = 8448
|
default_port = 8448
|
||||||
|
|
||||||
if port is None:
|
if port is None:
|
||||||
|
@ -80,7 +82,7 @@ class SpiderEndpoint(object):
|
||||||
Implements twisted.internet.interfaces.IStreamClientEndpoint.
|
Implements twisted.internet.interfaces.IStreamClientEndpoint.
|
||||||
"""
|
"""
|
||||||
def __init__(self, reactor, host, port, blacklist, whitelist,
|
def __init__(self, reactor, host, port, blacklist, whitelist,
|
||||||
endpoint=TCP4ClientEndpoint, endpoint_kw_args={}):
|
endpoint=HostnameEndpoint, endpoint_kw_args={}):
|
||||||
self.reactor = reactor
|
self.reactor = reactor
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
|
@ -118,7 +120,7 @@ class SRVClientEndpoint(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, reactor, service, domain, protocol="tcp",
|
def __init__(self, reactor, service, domain, protocol="tcp",
|
||||||
default_port=None, endpoint=TCP4ClientEndpoint,
|
default_port=None, endpoint=HostnameEndpoint,
|
||||||
endpoint_kw_args={}):
|
endpoint_kw_args={}):
|
||||||
self.reactor = reactor
|
self.reactor = reactor
|
||||||
self.service_name = "_%s._%s.%s" % (service, protocol, domain)
|
self.service_name = "_%s._%s.%s" % (service, protocol, domain)
|
||||||
|
|
Loading…
Reference in New Issue