Patchwork D3367: hgwebdir: un-bytes the env dict before re-parsing env

login
register
mail settings
Submitter phabricator
Date April 14, 2018, 2:41 p.m.
Message ID <68dec3a41790272755e0b2d94b172f38@localhost.localdomain>
Download mbox | patch
Permalink /patch/31037/
State Not Applicable
Headers show

Comments

phabricator - April 14, 2018, 2:41 p.m.
durin42 updated this revision to Diff 8275.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3367?vs=8244&id=8275

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

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -422,8 +422,12 @@ 
                 if real:
                     # Re-parse the WSGI environment to take into account our
                     # repository path component.
+                    uenv = req..rawenv
+                    if pycompat.ispy3:
+                        uenv = {k.decode('latin1'): v for k, v in
+                                uenv.iteritems()}
                     req = requestmod.parserequestfromenv(
-                        req.rawenv, reponame=virtualrepo,
+                        uenv, reponame=virtualrepo,
                         altbaseurl=self.ui.config('web', 'baseurl'))
                     try:
                         # ensure caller gets private copy of ui