Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/common.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 | 98baf8dea553 |
children | a2566597acb5 |
line wrap: on
line diff
--- a/mercurial/hgweb/common.py Sat Mar 10 20:16:20 2018 -0800 +++ b/mercurial/hgweb/common.py Sat Mar 10 18:19:27 2018 -0800 @@ -46,7 +46,7 @@ authentication info). Return if op allowed, else raise an ErrorResponse exception.''' - user = req.env.get(r'REMOTE_USER') + user = req.remoteuser deny_read = hgweb.configlist('web', 'deny_read') if deny_read and (not user or ismember(hgweb.repo.ui, user, deny_read)): @@ -62,14 +62,13 @@ return # enforce that you can only push using POST requests - if req.env[r'REQUEST_METHOD'] != r'POST': + if req.method != 'POST': msg = 'push requires POST request' raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg) # require ssl by default for pushing, auth info cannot be sniffed # and replayed - scheme = req.env.get('wsgi.url_scheme') - if hgweb.configbool('web', 'push_ssl') and scheme != 'https': + if hgweb.configbool('web', 'push_ssl') and req.urlscheme != 'https': raise ErrorResponse(HTTP_FORBIDDEN, 'ssl required') deny = hgweb.configlist('web', 'deny_push')