D1110: hgweb: when unpacking args from request form, convert to bytes
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Mon Oct 16 13:51:05 UTC 2017
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
We assume http-originated values are ASCII, which should be safe based
on the RFC.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D1110
AFFECTED FILES
mercurial/hgweb/protocol.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -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(
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list