diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-11-18 19:42:07 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-11-18 19:43:08 +0000 |
commit | 3e54d70ae210cc74e62fe5d31308a6d0fb8d31fb (patch) | |
tree | a7886c507f2deaacc0aa64e1d45fc50e07539ce9 /synapse | |
parent | more README fixes (diff) | |
download | synapse-3e54d70ae210cc74e62fe5d31308a6d0fb8d31fb.tar.xz |
SYN-141: Encode query params as UTF-8.
Diffstat (limited to '')
-rw-r--r-- | synapse/http/client.py | 8 |
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): |