GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing git.zx2c4.com — ui-shared: fix the Expires header on error pages - cgit - A hyperfast web frontend for git repositories written in C.
diff options
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 <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
Diffstat (limited to 'README') 0 files changed, 0 insertions, 0 deletions Copyright © 1996 – 2026 Jason A. Donenfeld. All Rights Reverse Engineered.
| ||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | ||||||||||||||||||||||||||||||||||||