# HG changeset patch # User Sune Foldager # Date 2018-06-14 11:44:42 # Node ID 519b46a8f4d2bfa6affb19149881517cb31d59af # Parent 523f64466a05436b5621f471897f948ba1e0a5ac 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. diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -441,6 +441,8 @@ class hgweb(object): res.headers['Content-Type'] = ctype return rctx.sendtemplate('error', error=pycompat.bytestr(e)) except ErrorResponse as e: + for k, v in e.headers: + res.headers[k] = v res.status = statusmessage(e.code, pycompat.bytestr(e)) res.headers['Content-Type'] = ctype return rctx.sendtemplate('error', error=pycompat.bytestr(e))