aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 38f0fdd..2039ab1 100644
--- a/cgit.c
+++ b/cgit.c
@@ -31,6 +31,8 @@ void config_cb(const char *name, const char *value)
31 ctx.cfg.favicon = xstrdup(value); 31 ctx.cfg.favicon = xstrdup(value);
32 else if (!strcmp(name, "footer")) 32 else if (!strcmp(name, "footer"))
33 ctx.cfg.footer = xstrdup(value); 33 ctx.cfg.footer = xstrdup(value);
34 else if (!strcmp(name, "head-include"))
35 ctx.cfg.head_include = xstrdup(value);
34 else if (!strcmp(name, "header")) 36 else if (!strcmp(name, "header"))
35 ctx.cfg.header = xstrdup(value); 37 ctx.cfg.header = xstrdup(value);
36 else if (!strcmp(name, "logo")) 38 else if (!strcmp(name, "logo"))
@@ -210,6 +212,7 @@ static void prepare_context(struct cgit_context *ctx)
210 ctx->page.size = 0; 212 ctx->page.size = 0;
211 ctx->page.modified = time(NULL); 213 ctx->page.modified = time(NULL);
212 ctx->page.expires = ctx->page.modified; 214 ctx->page.expires = ctx->page.modified;
215 ctx->page.etag = NULL;
213} 216}
214 217
215struct refmatch { 218struct refmatch {
@@ -289,6 +292,8 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
289 if (get_sha1(ctx->qry.head, sha1)) { 292 if (get_sha1(ctx->qry.head, sha1)) {
290 tmp = xstrdup(ctx->qry.head); 293 tmp = xstrdup(ctx->qry.head);
291 ctx->qry.head = ctx->repo->defbranch; 294 ctx->qry.head = ctx->repo->defbranch;
295 ctx->page.status = 404;
296 ctx->page.statusmsg = "not found";
292 cgit_print_http_headers(ctx); 297 cgit_print_http_headers(ctx);
293 cgit_print_docstart(ctx); 298 cgit_print_docstart(ctx);
294 cgit_print_pageheader(ctx); 299 cgit_print_pageheader(ctx);
@@ -433,6 +438,7 @@ static int calc_ttl()
433int main(int argc, const char **argv) 438int main(int argc, const char **argv)
434{ 439{
435 const char *cgit_config_env = getenv("CGIT_CONFIG"); 440 const char *cgit_config_env = getenv("CGIT_CONFIG");
441 const char *method = getenv("REQUEST_METHOD");
436 const char *path; 442 const char *path;
437 char *qry; 443 char *qry;
438 int err, ttl; 444 int err, ttl;
@@ -479,6 +485,8 @@ int main(int argc, const char **argv)
479 485
480 ttl = calc_ttl(); 486 ttl = calc_ttl();
481 ctx.page.expires += ttl*60; 487 ctx.page.expires += ttl*60;
488 if (method && !strcmp(method, "HEAD"))
489 ctx.cfg.nocache = 1;
482 if (ctx.cfg.nocache) 490 if (ctx.cfg.nocache)
483 ctx.cfg.cache_size = 0; 491 ctx.cfg.cache_size = 0;
484 err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, 492 err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root,