Mercurial > hg
changeset 34742:5a9cad0dfddb
hgweb: when unpacking args from request form, convert to bytes
We assume http-originated values are ASCII, which should be safe based
on the RFC.
Differential Revision: https://phab.mercurial-scm.org/D1110
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 15 Oct 2017 00:41:34 -0400 |
parents | 60143d038eb7 |
children | dc2bf7074147 |
files | mercurial/hgweb/protocol.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/protocol.py Sun Oct 15 00:39:53 2017 -0400 +++ b/mercurial/hgweb/protocol.py Sun Oct 15 00:41:34 2017 -0400 @@ -16,6 +16,7 @@ from .. import ( error, + pycompat, util, wireproto, ) @@ -65,6 +66,9 @@ return [data[k] for k in keys] def _args(self): args = self.req.form.copy() + if pycompat.ispy3: + args = {k.encode('ascii'): [v.encode('ascii') for v in vs] + for k, vs in args.items()} postlen = int(self.req.env.get('HTTP_X_HGARGS_POST', 0)) if postlen: args.update(cgi.parse_qs(