D2831: hgweb: store the raw WSGI environment dict

2018-03-12 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG84110a1d0f7d: hgweb: store the raw WSGI environment dict 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2831?vs=6897=6962

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

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/request.py

CHANGE DETAILS

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 @@
 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 @@
  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.
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 @@
 
 # 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,



To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2831: hgweb: store the raw WSGI environment dict

2018-03-12 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We need this so we can construct a new request instance
  from the original dict.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/request.py

CHANGE DETAILS

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 @@
 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 @@
  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.
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 @@
 
 # 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,



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel