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

login
register
mail settings
Submitter phabricator
Date April 14, 2018, 5:13 a.m.
Message ID <differential-rev-PHID-DREV-p4w5ne3qasapiiexc4vh-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30991/
State Superseded
Headers show

Comments

phabricator - April 14, 2018, 5:13 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Not the most elegant, but it restores
  test-subrepo-deep-nested-change.t to passing on Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - April 14, 2018, 11:45 a.m.
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> hgwebdir_mod.py:425
>                      # repository path component.
> +                    uenv = {k.decode('latin1'): v for k, v in
> +                            req.rawenv.iteritems()}

Maybe needs `if ispy3` ?

REPOSITORY
  rHG Mercurial

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

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,10 @@ 
                 if real:
                     # Re-parse the WSGI environment to take into account our
                     # repository path component.
+                    uenv = {k.decode('latin1'): v for k, v in
+                            req.rawenv.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