summary refs log tree commit diff
path: root/synapse/app/homeserver.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-13 11:47:32 +0000
committerErik Johnston <erik@matrix.org>2016-01-13 11:47:32 +0000
commit44b4fc5f50e9e77ec43e34b71041abdb272c6dea (patch)
treeb92973407030c523af00060dd39808e94556f949 /synapse/app/homeserver.py
parentDon't log urlencoded access_tokens (diff)
downloadsynapse-44b4fc5f50e9e77ec43e34b71041abdb272c6dea.tar.xz
Use compiled regex
Diffstat (limited to '')
-rwxr-xr-xsynapse/app/homeserver.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index bafac884a3..6928d9d3e4 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -88,6 +88,9 @@ import time
 logger = logging.getLogger("synapse.app.homeserver")
 
 
+ACCESS_TOKEN_RE = re.compile(r'(\?.*access(_|%5[Ff])token=)[^&]*(.*)$')
+
+
 def gz_wrap(r):
     return EncodingResourceWrapper(r, [GzipEncoderFactory()])
 
@@ -495,8 +498,7 @@ class SynapseRequest(Request):
         )
 
     def get_redacted_uri(self):
-        return re.sub(
-            r'(\?.*accesss(_|%5[Ff])token=)[^&]*(.*)$',
+        return ACCESS_TOKEN_RE.sub(
             r'\1<redacted>\3',
             self.uri
         )