summary refs log tree commit diff
path: root/synapse/server.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2015-09-15 16:52:38 +0100
committerDaniel Wagner-Hall <dawagner@gmail.com>2015-09-15 16:52:38 +0100
commit2c8f16257a3c8d4ad330f584f59f5e678207af14 (patch)
tree2745c1dff2e67b7bec31ca96d79bce999f9bf788 /synapse/server.py
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
parentUse shorter config key name (diff)
downloadsynapse-2c8f16257a3c8d4ad330f584f59f5e678207af14.tar.xz
Merge pull request #272 from matrix-org/daniel/insecureclient
Allow configuration to ignore invalid SSL certs
Diffstat (limited to 'synapse/server.py')
-rw-r--r--synapse/server.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/server.py b/synapse/server.py
index 4d1fb1cbf6..8424798b1b 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,  InsecureInterceptableContextFactory
 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,17 @@ class HomeServer(BaseHomeServer):
     def build_auth(self):
         return Auth(self)
 
+    def build_http_client_context_factory(self):
+        config = self.get_config()
+        return (
+            InsecureInterceptableContextFactory()
+            if config.use_insecure_ssl_client_just_for_testing_do_not_use
+            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,