diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-09 23:54:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-09 23:54:05 +0100 |
commit | 87478c5a6007b2a21933c1200f2741b6f3d0df3e (patch) | |
tree | 06221bbafb5a936ea7c19d7ae856b93a7ce3ff2e /synapse/api | |
parent | Merge pull request #3073 from NotAFile/use-six-reraise (diff) | |
parent | Add b prefixes to some strings that are bytes in py3 (diff) | |
download | synapse-87478c5a6007b2a21933c1200f2741b6f3d0df3e.tar.xz |
Merge pull request #3061 from NotAFile/add-some-byte-strings
Add b prefixes to some strings that are bytes in py3
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/auth.py | 10 |
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 |