Mercurial > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 36857:da4e2f87167d
hgweb: expose input stream on parsed WSGI request object
Our next step towards moving away from wsgirequest to our newer,
friendlier parsedrequest type is input stream access.
This commit exposes the input stream on the instance. Consumers
in the HTTP protocol server switch to it.
Because there were very few consumers of the input stream, we stopped
storing a reference to the input stream on wsgirequest directly. All
access now goes through parsedrequest. However, wsgirequest still
may read from this stream as part of cgi.parse(). So we still need to
create the stream from wsgirequest.
Differential Revision: https://phab.mercurial-scm.org/D2771
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 11:06:13 -0800 |
parents | 1f7d9024674c |
children | 1a1972b1a1ff |
comparison
equal
deleted
inserted
replaced
36856:1f7d9024674c | 36857:da4e2f87167d |
---|---|
289 wsgireq.env['REPO_NAME'] = virtualrepo | 289 wsgireq.env['REPO_NAME'] = virtualrepo |
290 # We have to re-parse because of updated environment | 290 # We have to re-parse because of updated environment |
291 # variable. | 291 # variable. |
292 # TODO this is kind of hacky and we should have a better | 292 # TODO this is kind of hacky and we should have a better |
293 # way of doing this than with REPO_NAME side-effects. | 293 # way of doing this than with REPO_NAME side-effects. |
294 wsgireq.req = requestmod.parserequestfromenv(wsgireq.env) | 294 wsgireq.req = requestmod.parserequestfromenv( |
295 wsgireq.env, wsgireq.req.bodyfh) | |
295 try: | 296 try: |
296 # ensure caller gets private copy of ui | 297 # ensure caller gets private copy of ui |
297 repo = hg.repository(self.ui.copy(), real) | 298 repo = hg.repository(self.ui.copy(), real) |
298 return hgweb_mod.hgweb(repo).run_wsgi(wsgireq) | 299 return hgweb_mod.hgweb(repo).run_wsgi(wsgireq) |
299 except IOError as inst: | 300 except IOError as inst: |