summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 7c1ad6bc13..fca6f06e3b 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -143,6 +143,7 @@ class SynapseHomeServer(HomeServer):
         port = listener_config["port"]
         bind_address = listener_config.get("bind_address", "")
         tls = listener_config.get("tls", False)
+        site_tag = listener_config.get("tag", port)
 
         if tls and config.no_tls:
             return
@@ -199,6 +200,7 @@ class SynapseHomeServer(HomeServer):
                 port,
                 SynapseSite(
                     "synapse.access.https",
+                    site_tag,
                     listener_config,
                     root_resource,
                 ),
@@ -210,6 +212,7 @@ class SynapseHomeServer(HomeServer):
                 port,
                 SynapseSite(
                     "synapse.access.https",
+                    site_tag,
                     listener_config,
                     root_resource,
                 ),
@@ -458,6 +461,9 @@ class SynapseRequest(Request):
             self.uri
         )
 
+    def get_user_agent(self):
+        return self.requestHeaders.getRawHeaders("User-Agent", [None])[-1]
+
 
 class XForwardedForRequest(SynapseRequest):
     def __init__(self, *args, **kw):
@@ -494,11 +500,11 @@ class SynapseSite(Site):
     Subclass of a twisted http Site that does access logging with python's
     standard logging
     """
-    def __init__(self, logger_name, config, resource, *args, **kwargs):
+    def __init__(self, logger_name, tag, config, resource, *args, **kwargs):
         Site.__init__(self, resource, *args, **kwargs)
 
         proxied = config.get("x_forwarded", False)
-        self.requestFactory = SynapseRequestFactory(None, proxied)
+        self.requestFactory = SynapseRequestFactory(tag, proxied)
 
         if proxied:
             self._log_formatter = proxiedLogFormatter