summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-07-21 11:14:54 +0100
committerErik Johnston <erik@matrix.org>2016-07-21 11:14:54 +0100
commit081e5d55e68b1a55d4f52ef062084d9126ce2231 (patch)
tree9733450d47dc46035061dd03207f8d6dfc654077
parentMerge pull request #938 from matrix-org/rav/add_device_id_to_client_ips (diff)
downloadsynapse-081e5d55e68b1a55d4f52ef062084d9126ce2231.tar.xz
Send the correct host header when fetching keys
-rw-r--r--synapse/crypto/keyclient.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/crypto/keyclient.py b/synapse/crypto/keyclient.py
index 54b83da9d8..4fca215c97 100644
--- a/synapse/crypto/keyclient.py
+++ b/synapse/crypto/keyclient.py
@@ -79,8 +79,7 @@ class SynapseKeyClientProtocol(HTTPClient):
         self.host = None
 
     def connectionMade(self):
-        self.host = self.transport.getHost()
-        logger.debug("Connected to %s", self.host)
+        logger.debug("Connected to %s", self.transport.getPeer())
         self.sendCommand(b"GET", self.path)
         if self.host:
             self.sendHeader(b"Host", self.host)
@@ -124,7 +123,10 @@ class SynapseKeyClientProtocol(HTTPClient):
         self.timer.cancel()
 
     def on_timeout(self):
-        logger.debug("Timeout waiting for response from %s", self.host)
+        logger.debug(
+            "Timeout waiting for response from %s: %s",
+            self.host, self.transport.getPeer(),
+        )
         self.errback(IOError("Timeout waiting for response"))
         self.transport.abortConnection()
 
@@ -133,4 +135,5 @@ class SynapseKeyClientFactory(Factory):
     def protocol(self):
         protocol = SynapseKeyClientProtocol()
         protocol.path = self.path
+        protocol.path = self.host
         return protocol