diff -r 8ddb5c354906 -r 7ad6a275316f mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Sat Mar 10 14:06:58 2018 -0800 +++ b/mercurial/hgweb/hgweb_mod.py Sat Mar 10 14:19:27 2018 -0800 @@ -18,7 +18,6 @@ HTTP_NOT_MODIFIED, HTTP_OK, HTTP_SERVER_ERROR, - caching, cspvalues, permhooks, ) @@ -388,7 +387,13 @@ # Don't enable caching if using a CSP nonce because then it wouldn't # be a nonce. if rctx.configbool('web', 'cache') and not rctx.nonce: - caching(self, wsgireq) # sets ETag header or raises NOT_MODIFIED + tag = 'W/"%d"' % self.mtime + if req.headers.get('If-None-Match') == tag: + raise ErrorResponse(HTTP_NOT_MODIFIED) + + wsgireq.headers.append((r'ETag', pycompat.sysstr(tag))) + res.headers['ETag'] = tag + if cmd not in webcommands.__all__: msg = 'no such method: %s' % cmd raise ErrorResponse(HTTP_BAD_REQUEST, msg)