summary refs log tree commit diff
path: root/synapse/api/auth.py
diff options
context:
space:
mode:
authorAdrian Tschira <nota@notafile.com>2018-04-03 20:41:21 +0200
committerAdrian Tschira <nota@notafile.com>2018-04-04 13:48:51 +0200
commit616835187702a0c6f16042e3efb452e1ee3e7826 (patch)
tree88e4de3798a90b18fb2dbe572ba362aa8eaab3c4 /synapse/api/auth.py
parentMerge pull request #3049 from matrix-org/rav/use_staticjson (diff)
downloadsynapse-616835187702a0c6f16042e3efb452e1ee3e7826.tar.xz
Add b prefixes to some strings that are bytes in py3
This has no effect on python2

Signed-off-by: Adrian Tschira <nota@notafile.com>
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r--synapse/api/auth.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index ac0a3655a5..f17fda6315 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -204,8 +204,8 @@ class Auth(object):
 
             ip_addr = self.hs.get_ip_from_request(request)
             user_agent = request.requestHeaders.getRawHeaders(
-                "User-Agent",
-                default=[""]
+                b"User-Agent",
+                default=[b""]
             )[0]
             if user and access_token and ip_addr:
                 self.store.insert_client_ip(
@@ -672,7 +672,7 @@ def has_access_token(request):
         bool: False if no access_token was given, True otherwise.
     """
     query_params = request.args.get("access_token")
-    auth_headers = request.requestHeaders.getRawHeaders("Authorization")
+    auth_headers = request.requestHeaders.getRawHeaders(b"Authorization")
     return bool(query_params) or bool(auth_headers)
 
 
@@ -692,8 +692,8 @@ def get_access_token_from_request(request, token_not_found_http_status=401):
         AuthError: If there isn't an access_token in the request.
     """
 
-    auth_headers = request.requestHeaders.getRawHeaders("Authorization")
-    query_params = request.args.get("access_token")
+    auth_headers = request.requestHeaders.getRawHeaders(b"Authorization")
+    query_params = request.args.get(b"access_token")
     if auth_headers:
         # Try the get the access_token from a "Authorization: Bearer"
         # header