summary refs log tree commit diff
path: root/synapse/http/matrixfederationclient.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-06-16 10:43:29 -0400
committerGitHub <noreply@github.com>2020-06-16 10:43:29 -0400
commitac51bd581aa98b8972d785a898d6233def9b636a (patch)
treeb4c9fd06a6a4991ee9bb01b23fcc935d5f7ecabe /synapse/http/matrixfederationclient.py
parentReplace all remaining six usage with native Python 3 equivalents (#7704) (diff)
downloadsynapse-ac51bd581aa98b8972d785a898d6233def9b636a.tar.xz
Include a user agent in federation requests. (#7677)
Diffstat (limited to 'synapse/http/matrixfederationclient.py')
-rw-r--r--synapse/http/matrixfederationclient.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py
index 7b33b9f10a..18f6a8fd29 100644
--- a/synapse/http/matrixfederationclient.py
+++ b/synapse/http/matrixfederationclient.py
@@ -197,7 +197,14 @@ class MatrixFederationHttpClient(object):
 
         self.reactor = Reactor()
 
-        self.agent = MatrixFederationAgent(self.reactor, tls_client_options_factory)
+        user_agent = hs.version_string
+        if hs.config.user_agent_suffix:
+            user_agent = "%s %s" % (user_agent, hs.config.user_agent_suffix)
+        user_agent = user_agent.encode("ascii")
+
+        self.agent = MatrixFederationAgent(
+            self.reactor, tls_client_options_factory, user_agent
+        )
 
         # Use a BlacklistingAgentWrapper to prevent circumventing the IP
         # blacklist via IP literals in server names