comparison mercurial/hgweb/request.py @ 36909:84110a1d0f7d

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Mar 2018 16:19:20 -0700
parents cd6ae9ab7bd8
children f0a851542a05
comparison
equal deleted inserted replaced
36908:cd6ae9ab7bd8 36909:84110a1d0f7d
147 # wsgiref.headers.Headers instance. Operates like a dict with case 147 # wsgiref.headers.Headers instance. Operates like a dict with case
148 # insensitive keys. 148 # insensitive keys.
149 headers = attr.ib() 149 headers = attr.ib()
150 # Request body input stream. 150 # Request body input stream.
151 bodyfh = attr.ib() 151 bodyfh = attr.ib()
152 # WSGI environment dict, unmodified.
153 rawenv = attr.ib()
152 154
153 def parserequestfromenv(env, bodyfh, reponame=None, altbaseurl=None): 155 def parserequestfromenv(env, bodyfh, reponame=None, altbaseurl=None):
154 """Parse URL components from environment variables. 156 """Parse URL components from environment variables.
155 157
156 WSGI defines request attributes via environment variables. This function 158 WSGI defines request attributes via environment variables. This function
340 dispatchparts=dispatchparts, dispatchpath=dispatchpath, 342 dispatchparts=dispatchparts, dispatchpath=dispatchpath,
341 reponame=reponame, 343 reponame=reponame,
342 querystring=querystring, 344 querystring=querystring,
343 qsparams=qsparams, 345 qsparams=qsparams,
344 headers=headers, 346 headers=headers,
345 bodyfh=bodyfh) 347 bodyfh=bodyfh,
348 rawenv=env)
346 349
347 class offsettrackingwriter(object): 350 class offsettrackingwriter(object):
348 """A file object like object that is append only and tracks write count. 351 """A file object like object that is append only and tracks write count.
349 352
350 Instances are bound to a callable. This callable is called with data 353 Instances are bound to a callable. This callable is called with data