Website Summary Files Commits Branches @commit @diff @stats
path: root / ui-patch.c
diff options
context:
space:
mode:
Commit156e859aad4c98a169ce4c49e839cae41a28f432 (patch)
Author
 Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2026-08-25 15:07:25 +0000
Committer
 Jason A. Donenfeld <Jason@zx2c4.com>
2026-09-18 13:51:15 +0200
Files04ebccf8c33913c76bef980ffe405d7164f7249c /ui-patch.c
cgit-156e859aad4c98a169ce4c49e839cae41a28f432.tar
cgit-156e859aad4c98a169ce4c49e839cae41a28f432.tar.gz
cgit-156e859aad4c98a169ce4c49e839cae41a28f432.zip
Parent599e3df55ff0ce7387172c16cba269d545019ed3 (diff)
ui-shared: fix the Expires header on error pages master
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>
0 files changed, 0 insertions, 0 deletions