Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/common.py @ 36869:7ad6a275316f
hgweb: inline caching() and port to modern mechanisms
We only had one consumer of this simple function. While it could be
a generic function, let's not over abstract the code.
As part of inlining, we port it off wsgirequest, fix some Python 3
issues, and set a response header on our new response object so it
is ready once we start using it to send responses.
Differential Revision: https://phab.mercurial-scm.org/D2785
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 14:19:27 -0800 |
parents | 7066617187c1 |
children | 98baf8dea553 |
line wrap: on
line diff
--- a/mercurial/hgweb/common.py Sat Mar 10 14:06:58 2018 -0800 +++ b/mercurial/hgweb/common.py Sat Mar 10 14:19:27 2018 -0800 @@ -214,12 +214,6 @@ config("ui", "username") or encoding.environ.get("EMAIL") or "") -def caching(web, req): - tag = r'W/"%d"' % web.mtime - if req.env.get('HTTP_IF_NONE_MATCH') == tag: - raise ErrorResponse(HTTP_NOT_MODIFIED) - req.headers.append(('ETag', tag)) - def cspvalues(ui): """Obtain the Content-Security-Policy header and nonce value.