From: "Bernhard M. Wiedemann" <[email protected]>

according to my understanding of the code,
the expiry value needs to be a UNIX timestamp
while the ttl value is an offset in minutes, defaulting to 5.

This patch was done while reviewing potential year-2038 issues in openSUSE.

--

Note: I did not test this and don't know the codebase,
so review/test carefully. E.g. is the "modified" value set there?
And do we actually want to set an expiry there?
---
 ui-shared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui-shared.c b/ui-shared.c
index 219b830..a09a72a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -889,7 +889,7 @@ void cgit_print_docend(void)
 void cgit_print_error_page(int code, const char *msg, const char *fmt, ...)
 {
        va_list ap;
-       ctx.page.expires = ctx.cfg.cache_dynamic_ttl;
+       ctx.page.expires = ctx.page.modified + 60 * ctx.cfg.cache_dynamic_ttl;
        ctx.page.status = code;
        ctx.page.statusmsg = msg;
        cgit_print_layout_start();
-- 
2.51.1

Reply via email to