Fix handling of User-Agent headers with bad utf-8. (#8632)

This commit is contained in:
Erik Johnston 2020-10-23 17:12:59 +01:00 committed by GitHub
parent db9ef792f0
commit c850dd9a8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 28 deletions

View file

@ -695,9 +695,7 @@ class OidcHandler:
return
# Pull out the user-agent and IP from the request.
user_agent = request.requestHeaders.getRawHeaders(b"User-Agent", default=[b""])[
0
].decode("ascii", "surrogateescape")
user_agent = request.get_user_agent("")
ip_address = self.hs.get_ip_from_request(request)
# Call the mapper to register/login the user