Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 36883:02bea04b4c54
hgweb: transition permissions hooks to modern request type (API)
We're trying to remove ``wsgirequest``. The permissions hooks don't
do anything they can't do with our new request type. So let's
pass that in.
This was the last use of ``wsgirequest`` in the wire protocol code!
.. api::
hgweb.hgweb_mod.permhooks no longer take a ``wsgirequest`` instance
as an argument.
Differential Revision: https://phab.mercurial-scm.org/D2793
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 18:19:27 -0800 |
parents | 97f44b0720e2 |
children | ccb70a77f746 |
comparison
equal
deleted
inserted
replaced
36882:97f44b0720e2 | 36883:02bea04b4c54 |
---|---|
320 if h[0] != 'Content-Security-Policy'] | 320 if h[0] != 'Content-Security-Policy'] |
321 wsgireq.headers.append(('Content-Security-Policy', rctx.csp)) | 321 wsgireq.headers.append(('Content-Security-Policy', rctx.csp)) |
322 res.headers['Content-Security-Policy'] = rctx.csp | 322 res.headers['Content-Security-Policy'] = rctx.csp |
323 | 323 |
324 handled = wireprotoserver.handlewsgirequest( | 324 handled = wireprotoserver.handlewsgirequest( |
325 rctx, wsgireq, req, res, self.check_perm) | 325 rctx, req, res, self.check_perm) |
326 if handled: | 326 if handled: |
327 return res.sendresponse() | 327 return res.sendresponse() |
328 | 328 |
329 if req.havepathinfo: | 329 if req.havepathinfo: |
330 query = req.dispatchpath | 330 query = req.dispatchpath |
378 ctype = tmpl('mimetype', encoding=encoding.encoding) | 378 ctype = tmpl('mimetype', encoding=encoding.encoding) |
379 ctype = templater.stringify(ctype) | 379 ctype = templater.stringify(ctype) |
380 | 380 |
381 # check read permissions non-static content | 381 # check read permissions non-static content |
382 if cmd != 'static': | 382 if cmd != 'static': |
383 self.check_perm(rctx, wsgireq, None) | 383 self.check_perm(rctx, req, None) |
384 | 384 |
385 if cmd == '': | 385 if cmd == '': |
386 req.qsparams['cmd'] = tmpl.cache['default'] | 386 req.qsparams['cmd'] = tmpl.cache['default'] |
387 cmd = req.qsparams['cmd'] | 387 cmd = req.qsparams['cmd'] |
388 | 388 |