summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2018-06-11 16:02:00 +0100
committerGitHub <noreply@github.com>2018-06-11 16:02:00 +0100
commit187a546bffd08e2a8c66761746001b36b93a90e4 (patch)
tree62c9be434967d4a555341ec47ac802a05bfdd07d /synapse/http
parentfix idiotic typo in state res (diff)
parentpep8 (diff)
downloadsynapse-187a546bffd08e2a8c66761746001b36b93a90e4.tar.xz
Merge pull request #3276 from matrix-org/dbkr/unbind
Remove email addresses / phone numbers from ID servers when they're removed from synapse
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/matrixfederationclient.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py
index 821aed362b..993dc06e02 100644
--- a/synapse/http/matrixfederationclient.py
+++ b/synapse/http/matrixfederationclient.py
@@ -260,14 +260,35 @@ class MatrixFederationHttpClient(object):
             defer.returnValue(response)
 
     def sign_request(self, destination, method, url_bytes, headers_dict,
-                     content=None):
+                     content=None, destination_is=None):
+        """
+        Signs a request by adding an Authorization header to headers_dict
+        Args:
+            destination (bytes|None): The desination home server of the request.
+                May be None if the destination is an identity server, in which case
+                destination_is must be non-None.
+            method (bytes): The HTTP method of the request
+            url_bytes (bytes): The URI path of the request
+            headers_dict (dict): Dictionary of request headers to append to
+            content (bytes): The body of the request
+            destination_is (bytes): As 'destination', but if the destination is an
+                identity server
+
+        Returns:
+            None
+        """
         request = {
             "method": method,
             "uri": url_bytes,
             "origin": self.server_name,
-            "destination": destination,
         }
 
+        if destination is not None:
+            request["destination"] = destination
+
+        if destination_is is not None:
+            request["destination_is"] = destination_is
+
         if content is not None:
             request["content"] = content