X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/488a214a81a25c6397c56822ed1713f51dddc520..681fdc45473143de3f3c5f69fbc7b94f5d6b0b75:/cgit.c diff --git a/cgit.c b/cgit.c index 411e421..ae20257 100644 --- a/cgit.c +++ b/cgit.c @@ -286,6 +286,8 @@ static int prepare_repo_cmd(struct cgit_context *ctx) if (get_sha1(ctx->qry.head, sha1)) { tmp = xstrdup(ctx->qry.head); ctx->qry.head = ctx->repo->defbranch; + ctx->page.status = 404; + ctx->page.statusmsg = "not found"; cgit_print_http_headers(ctx); cgit_print_docstart(ctx); cgit_print_pageheader(ctx); @@ -430,6 +432,7 @@ static int calc_ttl() int main(int argc, const char **argv) { const char *cgit_config_env = getenv("CGIT_CONFIG"); + const char *method = getenv("REQUEST_METHOD"); const char *path; char *qry; int err, ttl; @@ -476,6 +479,8 @@ int main(int argc, const char **argv) ttl = calc_ttl(); ctx.page.expires += ttl*60; + if (method && !strcmp(method, "HEAD")) + ctx.cfg.nocache = 1; if (ctx.cfg.nocache) ctx.cfg.cache_size = 0; err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root,