summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-11-18 19:42:07 +0000
committerMark Haines <mark.haines@matrix.org>2014-11-18 19:43:08 +0000
commit3e54d70ae210cc74e62fe5d31308a6d0fb8d31fb (patch)
treea7886c507f2deaacc0aa64e1d45fc50e07539ce9 /synapse/http
parentmore README fixes (diff)
downloadsynapse-3e54d70ae210cc74e62fe5d31308a6d0fb8d31fb.tar.xz
SYN-141: Encode query params as UTF-8.
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/client.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 29e6053bc1..dea61ba1e0 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -260,7 +260,13 @@ class MatrixHttpClient(BaseHttpClient):
         """
         logger.debug("get_json args: %s", args)
 
-        query_bytes = urllib.urlencode(args, True)
+        encoded_args = {}
+        for k, vs in args.items():
+            if isinstance(vs, basestring):
+                vs = [vs]
+            encoded_args[k] = [v.encode("UTF-8") for v in vs]
+
+        query_bytes = urllib.urlencode(encoded_args, True)
         logger.debug("Query bytes: %s Retry DNS: %s", args, retry_on_dns_fail)
 
         def body_callback(method, url_bytes, headers_dict):