aboutsummaryrefslogtreecommitdiffstats
path: root/scan-tree.c
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2026-08-25 15:07:25 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2026-09-18 13:51:15 +0200
commit156e859aad4c98a169ce4c49e839cae41a28f432 (patch)
tree04ebccf8c33913c76bef980ffe405d7164f7249c /scan-tree.c
parenthtml: use buffered stdio (diff)
downloadcgit-master.tar.xz
cgit-master.zip
ui-shared: fix the Expires header on error pagesHEADmaster
page.expires is an absolute time: the normal path seeds it from page.modified and adds the relevant TTL in seconds. The error page instead assigns cache-dynamic-ttl directly, which is a count of minutes and carries no base, so every error page cgit has produced since "ui-shared: cache errors for dynamic TTL" reports Expires: Thu, 01 Jan 1970 00:00:05 GMT five seconds past the epoch, which is the value of the default TTL read as seconds. The intent of that change was to stop errors being cached forever; the effect is that they are never cached at all, since every downstream cache is told the response was already stale. Seed the value from page.modified and scale the TTL to seconds, matching what calc_ttl() does for ordinary pages. prepare_context() sets page.modified before anything can produce an error page, so the base is always available. Add a test. The header can be checked without any date arithmetic: a TTL of zero has to reproduce Last-Modified exactly, and a non-zero one has to differ from it without falling back to the epoch. Fixes: c5975ae ("ui-shared: cache errors for "dynamic TTL"") Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'scan-tree.c')
0 files changed, 0 insertions, 0 deletions