summary refs log tree commit diff
path: root/synapse/server.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-09-09 14:27:30 +0100
committerDaniel Wagner-Hall <daniel@matrix.org>2015-09-09 14:27:30 +0100
commit2c746382e0a5da7e0640b149b2a4620706967324 (patch)
treea3629622a9035033fae45d43bc988b5ac51e8961 /synapse/server.py
parentDon't require pdus in check_auth script (diff)
parentBetter document the intent of the insecure SSL setting (diff)
downloadsynapse-2c746382e0a5da7e0640b149b2a4620706967324.tar.xz
Merge branch 'daniel/insecureclient' into develop
Diffstat (limited to 'synapse/server.py')
-rw-r--r--synapse/server.py14
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,