Mercurial > hg
comparison mercurial/hgweb/hgweb_mod.py @ 38307:519b46a8f4d2
hgweb: propagate http headers from ErrorResponse for web interface commands
This makes it possible for e.g. authorization hooks to provide appropriate
headers to make the web browser ask for credentials.
It's done in the same way as the existing code in wireprotoserver.py.
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Thu, 14 Jun 2018 13:44:42 +0200 |
parents | 5b831053d9b6 |
children | 258d90f69076 |
comparison
equal
deleted
inserted
replaced
38306:523f64466a05 | 38307:519b46a8f4d2 |
---|---|
439 except (error.RepoError, error.RevlogError) as e: | 439 except (error.RepoError, error.RevlogError) as e: |
440 res.status = '500 Internal Server Error' | 440 res.status = '500 Internal Server Error' |
441 res.headers['Content-Type'] = ctype | 441 res.headers['Content-Type'] = ctype |
442 return rctx.sendtemplate('error', error=pycompat.bytestr(e)) | 442 return rctx.sendtemplate('error', error=pycompat.bytestr(e)) |
443 except ErrorResponse as e: | 443 except ErrorResponse as e: |
444 for k, v in e.headers: | |
445 res.headers[k] = v | |
444 res.status = statusmessage(e.code, pycompat.bytestr(e)) | 446 res.status = statusmessage(e.code, pycompat.bytestr(e)) |
445 res.headers['Content-Type'] = ctype | 447 res.headers['Content-Type'] = ctype |
446 return rctx.sendtemplate('error', error=pycompat.bytestr(e)) | 448 return rctx.sendtemplate('error', error=pycompat.bytestr(e)) |
447 | 449 |
448 def check_perm(self, rctx, req, op): | 450 def check_perm(self, rctx, req, op): |