diff -r 1121af239761 -r f64b416b0ac8 mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Wed Sep 08 15:11:35 2010 +0200 +++ b/mercurial/hgweb/common.py Wed Sep 08 15:23:48 2010 +0200 @@ -9,6 +9,7 @@ import errno, mimetypes, os HTTP_OK = 200 +HTTP_NOT_MODIFIED = 304 HTTP_BAD_REQUEST = 400 HTTP_UNAUTHORIZED = 401 HTTP_FORBIDDEN = 403 @@ -152,3 +153,9 @@ return (config("web", "contact") or config("ui", "username") or os.environ.get("EMAIL") or "") + +def caching(web, req): + tag = str(web.mtime) + if req.env.get('HTTP_IF_NONE_MATCH') == tag: + raise ErrorResponse(HTTP_NOT_MODIFIED) + req.headers.append(('ETag', tag))