# HG changeset patch # User Gregory Szorc # Date 2018-03-11 23:19:20 # Node ID 84110a1d0f7dd1d43f82c9ca5b214ceccc042c67 # Parent cd6ae9ab7bd884d99429438fd8e1b83d785fc983 hgweb: store the raw WSGI environment dict We need this so we can construct a new request instance from the original dict. Differential Revision: https://phab.mercurial-scm.org/D2831 diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -312,7 +312,7 @@ class hgweb(object): # This state is global across all threads. encoding.encoding = rctx.config('web', 'encoding') - rctx.repo.ui.environ = wsgireq.env + rctx.repo.ui.environ = req.rawenv if rctx.csp: # hgwebdir may have added CSP header. Since we generate our own, diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -149,6 +149,8 @@ class parsedrequest(object): headers = attr.ib() # Request body input stream. bodyfh = attr.ib() + # WSGI environment dict, unmodified. + rawenv = attr.ib() def parserequestfromenv(env, bodyfh, reponame=None, altbaseurl=None): """Parse URL components from environment variables. @@ -342,7 +344,8 @@ def parserequestfromenv(env, bodyfh, rep querystring=querystring, qsparams=qsparams, headers=headers, - bodyfh=bodyfh) + bodyfh=bodyfh, + rawenv=env) class offsettrackingwriter(object): """A file object like object that is append only and tracks write count.