Mercurial > hg
comparison mercurial/hgweb/common.py @ 36296:d18c0cf5f3ab
hgweb: header dict entries are native strings
# skip-blame just marking some native strings
Differential Revision: https://phab.mercurial-scm.org/D2312
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 18 Feb 2018 00:03:27 -0500 |
parents | 6ef744a7df65 |
children | 7a3590e67868 |
comparison
equal
deleted
inserted
replaced
36295:19a04ca90413 | 36296:d18c0cf5f3ab |
---|---|
43 def checkauthz(hgweb, req, op): | 43 def checkauthz(hgweb, req, op): |
44 '''Check permission for operation based on request data (including | 44 '''Check permission for operation based on request data (including |
45 authentication info). Return if op allowed, else raise an ErrorResponse | 45 authentication info). Return if op allowed, else raise an ErrorResponse |
46 exception.''' | 46 exception.''' |
47 | 47 |
48 user = req.env.get('REMOTE_USER') | 48 user = req.env.get(r'REMOTE_USER') |
49 | 49 |
50 deny_read = hgweb.configlist('web', 'deny_read') | 50 deny_read = hgweb.configlist('web', 'deny_read') |
51 if deny_read and (not user or ismember(hgweb.repo.ui, user, deny_read)): | 51 if deny_read and (not user or ismember(hgweb.repo.ui, user, deny_read)): |
52 raise ErrorResponse(HTTP_UNAUTHORIZED, 'read not authorized') | 52 raise ErrorResponse(HTTP_UNAUTHORIZED, 'read not authorized') |
53 | 53 |
59 raise ErrorResponse(HTTP_UNAUTHORIZED, 'pull not authorized') | 59 raise ErrorResponse(HTTP_UNAUTHORIZED, 'pull not authorized') |
60 elif op == 'pull' or op is None: # op is None for interface requests | 60 elif op == 'pull' or op is None: # op is None for interface requests |
61 return | 61 return |
62 | 62 |
63 # enforce that you can only push using POST requests | 63 # enforce that you can only push using POST requests |
64 if req.env['REQUEST_METHOD'] != 'POST': | 64 if req.env[r'REQUEST_METHOD'] != r'POST': |
65 msg = 'push requires POST request' | 65 msg = 'push requires POST request' |
66 raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg) | 66 raise ErrorResponse(HTTP_METHOD_NOT_ALLOWED, msg) |
67 | 67 |
68 # require ssl by default for pushing, auth info cannot be sniffed | 68 # require ssl by default for pushing, auth info cannot be sniffed |
69 # and replayed | 69 # and replayed |