Skip to content
Snippets Groups Projects
Unverified Commit ff0680f6 authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Stop passing bytes when dumping JSON (#7799)

parent e0c01296
No related branches found
No related tags found
No related merge requests found
Ensure that strings (not bytes) are passed into JSON serialization.
......@@ -251,10 +251,10 @@ class IdentityHandler(BaseHandler):
# 'browser-like' HTTPS.
auth_headers = self.federation_http_client.build_auth_headers(
destination=None,
method="POST",
method=b"POST",
url_bytes=url_bytes,
content=content,
destination_is=id_server,
destination_is=id_server.encode("ascii"),
)
headers = {b"Authorization": auth_headers}
......
......@@ -562,13 +562,17 @@ class MatrixFederationHttpClient(object):
Returns:
list[bytes]: a list of headers to be added as "Authorization:" headers
"""
request = {"method": method, "uri": url_bytes, "origin": self.server_name}
request = {
"method": method.decode("ascii"),
"uri": url_bytes.decode("ascii"),
"origin": self.server_name,
}
if destination is not None:
request["destination"] = destination
request["destination"] = destination.decode("ascii")
if destination_is is not None:
request["destination_is"] = destination_is
request["destination_is"] = destination_is.decode("ascii")
if content is not None:
request["content"] = content
......
......@@ -50,7 +50,7 @@ class VoipRestServlet(RestServlet):
# We need to use standard padded base64 encoding here
# encode_base64 because we need to add the standard padding to get the
# same result as the TURN server.
password = base64.b64encode(mac.digest())
password = base64.b64encode(mac.digest()).decode("ascii")
elif turnUris and turnUsername and turnPassword and userLifetime:
username = turnUsername
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment