aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cgit.c b/cgit.c
index 950b878..a45ce1f 100644
--- a/cgit.c
+++ b/cgit.c
@@ -211,6 +211,8 @@ static void config_cb(const char *name, const char *value)
211 ctx.cfg.cache_static_ttl = atoi(value); 211 ctx.cfg.cache_static_ttl = atoi(value);
212 else if (!strcmp(name, "cache-dynamic-ttl")) 212 else if (!strcmp(name, "cache-dynamic-ttl"))
213 ctx.cfg.cache_dynamic_ttl = atoi(value); 213 ctx.cfg.cache_dynamic_ttl = atoi(value);
214 else if (!strcmp(name, "cache-about-ttl"))
215 ctx.cfg.cache_about_ttl = atoi(value);
214 else if (!strcmp(name, "case-sensitive-sort")) 216 else if (!strcmp(name, "case-sensitive-sort"))
215 ctx.cfg.case_sensitive_sort = atoi(value); 217 ctx.cfg.case_sensitive_sort = atoi(value);
216 else if (!strcmp(name, "about-filter")) 218 else if (!strcmp(name, "about-filter"))
@@ -351,12 +353,13 @@ static void prepare_context(struct cgit_context *ctx)
351 ctx->cfg.agefile = "info/web/last-modified"; 353 ctx->cfg.agefile = "info/web/last-modified";
352 ctx->cfg.nocache = 0; 354 ctx->cfg.nocache = 0;
353 ctx->cfg.cache_size = 0; 355 ctx->cfg.cache_size = 0;
354 ctx->cfg.cache_dynamic_ttl = 5;
355 ctx->cfg.cache_max_create_time = 5; 356 ctx->cfg.cache_max_create_time = 5;
356 ctx->cfg.cache_repo_ttl = 5;
357 ctx->cfg.cache_root = CGIT_CACHE_ROOT; 357 ctx->cfg.cache_root = CGIT_CACHE_ROOT;
358 ctx->cfg.cache_about_ttl = 15;
359 ctx->cfg.cache_repo_ttl = 5;
358 ctx->cfg.cache_root_ttl = 5; 360 ctx->cfg.cache_root_ttl = 5;
359 ctx->cfg.cache_scanrc_ttl = 15; 361 ctx->cfg.cache_scanrc_ttl = 15;
362 ctx->cfg.cache_dynamic_ttl = 5;
360 ctx->cfg.cache_static_ttl = -1; 363 ctx->cfg.cache_static_ttl = -1;
361 ctx->cfg.case_sensitive_sort = 1; 364 ctx->cfg.case_sensitive_sort = 1;
362 ctx->cfg.branch_sort = 0; 365 ctx->cfg.branch_sort = 0;
@@ -922,6 +925,9 @@ static int calc_ttl()
922 if (!ctx.qry.page) 925 if (!ctx.qry.page)
923 return ctx.cfg.cache_repo_ttl; 926 return ctx.cfg.cache_repo_ttl;
924 927
928 if (!strcmp(ctx.qry.page, "about"))
929 return ctx.cfg.cache_about_ttl;
930
925 if (ctx.qry.has_symref) 931 if (ctx.qry.has_symref)
926 return ctx.cfg.cache_dynamic_ttl; 932 return ctx.cfg.cache_dynamic_ttl;
927 933
@@ -973,7 +979,10 @@ int main(int argc, const char **argv)
973 } 979 }
974 980
975 ttl = calc_ttl(); 981 ttl = calc_ttl();
976 ctx.page.expires += ttl * 60; 982 if (ttl < 0)
983 ctx.page.expires += 10 * 365 * 24 * 60 * 60; /* 10 years */
984 else
985 ctx.page.expires += ttl * 60;
977 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD")) 986 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
978 ctx.cfg.nocache = 1; 987 ctx.cfg.nocache = 1;
979 if (ctx.cfg.nocache) 988 if (ctx.cfg.nocache)