diff options
author | Daniel Wagner-Hall <daniel@matrix.org> | 2015-09-09 12:02:07 +0100 |
---|---|---|
committer | Daniel Wagner-Hall <daniel@matrix.org> | 2015-09-09 12:02:07 +0100 |
commit | 81a93ddcc8798568276582ed9c7a63bc64dc5bc0 (patch) | |
tree | 6e90aaf6a19d5a7fd1f912111cb7ade49bb698cd /synapse/server.py | |
parent | update logger to match new ambiguous script name... (diff) | |
download | synapse-81a93ddcc8798568276582ed9c7a63bc64dc5bc0.tar.xz |
Allow configuration to ignore invalid SSL certs
This will be useful for sytest, and sytest only, hence the aggressive config key name.
Diffstat (limited to 'synapse/server.py')
-rw-r--r-- | synapse/server.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/server.py b/synapse/server.py index 4d1fb1cbf6..656e534dff 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -19,7 +19,9 @@ # partial one for unit test mocking. # Imports required for the default HomeServer() implementation +from twisted.web.client import BrowserLikePolicyForHTTPS from synapse.federation import initialize_http_replication +from synapse.http.client import SimpleHttpClient, WoefullyInsecureContextFactory from synapse.notifier import Notifier from synapse.api.auth import Auth from synapse.handlers import Handlers @@ -87,6 +89,8 @@ class BaseHomeServer(object): 'pusherpool', 'event_builder_factory', 'filtering', + 'http_client_context_factory', + 'simple_http_client', ] def __init__(self, hostname, **kwargs): @@ -174,6 +178,16 @@ class HomeServer(BaseHomeServer): def build_auth(self): return Auth(self) + def build_http_client_context_factory(self): + config = self.get_config() + return ( + WoefullyInsecureContextFactory() if config.use_insecure_ssl_client + else BrowserLikePolicyForHTTPS() + ) + + def build_simple_http_client(self): + return SimpleHttpClient(self) + def build_v1auth(self): orf = Auth(self) # Matrix spec makes no reference to what HTTP status code is returned, |