Patchwork D1110: hgweb: when unpacking args from request form, convert to bytes

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2017, 3:10 p.m.
Message ID <a67c44e79d07339ffb22938349df895c@localhost.localdomain>
Download mbox | patch
Permalink /patch/24997/
State Not Applicable
Headers show

Comments

phabricator - Oct. 16, 2017, 3:10 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5a9cad0dfddb: hgweb: when unpacking args from request form, convert to bytes (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1110?vs=2812&id=2818

REVISION DETAIL
  https://phab.mercurial-scm.org/D1110

AFFECTED FILES
  mercurial/hgweb/protocol.py

CHANGE DETAILS




To: durin42, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

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(