summary refs log tree commit diff
path: root/synapse/federation/transport.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-10-27 10:20:44 +0000
committerErik Johnston <erik@matrix.org>2014-10-27 10:20:44 +0000
commitbb4a20174cb9128a1d9d5b7bd3d11d98b070edb6 (patch)
treef7ea571aedd4f1c8ae74a7c9ba3356a6c2107351 /synapse/federation/transport.py
parentIt doesn't want a dict (diff)
parentAdd log message if we can't enable ECC. Require pyopenssl>=0.14 since 0.13 do... (diff)
downloadsynapse-bb4a20174cb9128a1d9d5b7bd3d11d98b070edb6.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into federation_authorization
Conflicts:
	synapse/federation/transport.py
	synapse/handlers/message.py
Diffstat (limited to 'synapse/federation/transport.py')
-rw-r--r--synapse/federation/transport.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py
index de64702e2f..7f01b4faaf 100644
--- a/synapse/federation/transport.py
+++ b/synapse/federation/transport.py
@@ -301,6 +301,11 @@ class TransportLayer(object):
 
         auth_headers = request.requestHeaders.getRawHeaders(b"Authorization")
 
+        if not auth_headers:
+            raise SynapseError(
+                401, "Missing Authorization headers", Codes.UNAUTHORIZED,
+            )
+
         for auth in auth_headers:
             if auth.startswith("X-Matrix"):
                 (origin, key, sig) = parse_auth_header(auth)
@@ -319,13 +324,13 @@ class TransportLayer(object):
     def _with_authentication(self, handler):
         @defer.inlineCallbacks
         def new_handler(request, *args, **kwargs):
-            (origin, content) = yield self._authenticate_request(request)
             try:
+                (origin, content) = yield self._authenticate_request(request)
                 response = yield handler(
                     origin, content, request.args, *args, **kwargs
                 )
             except:
-                logger.exception("Callback failed")
+                logger.exception("_authenticate_request failed")
                 raise
             defer.returnValue(response)
         return new_handler
@@ -496,9 +501,13 @@ class TransportLayer(object):
             defer.returnValue((400, {"error": "Invalid transaction"}))
             return
 
-        code, response = yield self.received_handler.on_incoming_transaction(
-            transaction_data
-        )
+        try:
+            code, response = yield self.received_handler.on_incoming_transaction(
+                transaction_data
+            )
+        except:
+            logger.exception("on_incoming_transaction failed")
+            raise
 
         defer.returnValue((code, response))