diff options
Diffstat (limited to 'cgit.c')
| -rw-r--r-- | cgit.c | 6 |
1 files changed, 6 insertions, 0 deletions
| @@ -208,6 +208,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
| 208 | ctx->page.size = 0; | 208 | ctx->page.size = 0; |
| 209 | ctx->page.modified = time(NULL); | 209 | ctx->page.modified = time(NULL); |
| 210 | ctx->page.expires = ctx->page.modified; | 210 | ctx->page.expires = ctx->page.modified; |
| 211 | ctx->page.etag = NULL; | ||
| 211 | } | 212 | } |
| 212 | 213 | ||
| 213 | struct refmatch { | 214 | struct refmatch { |
| @@ -287,6 +288,8 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
| 287 | if (get_sha1(ctx->qry.head, sha1)) { | 288 | if (get_sha1(ctx->qry.head, sha1)) { |
| 288 | tmp = xstrdup(ctx->qry.head); | 289 | tmp = xstrdup(ctx->qry.head); |
| 289 | ctx->qry.head = ctx->repo->defbranch; | 290 | ctx->qry.head = ctx->repo->defbranch; |
| 291 | ctx->page.status = 404; | ||
| 292 | ctx->page.statusmsg = "not found"; | ||
| 290 | cgit_print_http_headers(ctx); | 293 | cgit_print_http_headers(ctx); |
| 291 | cgit_print_docstart(ctx); | 294 | cgit_print_docstart(ctx); |
| 292 | cgit_print_pageheader(ctx); | 295 | cgit_print_pageheader(ctx); |
| @@ -431,6 +434,7 @@ static int calc_ttl() | |||
| 431 | int main(int argc, const char **argv) | 434 | int main(int argc, const char **argv) |
| 432 | { | 435 | { |
| 433 | const char *cgit_config_env = getenv("CGIT_CONFIG"); | 436 | const char *cgit_config_env = getenv("CGIT_CONFIG"); |
| 437 | const char *method = getenv("REQUEST_METHOD"); | ||
| 434 | const char *path; | 438 | const char *path; |
| 435 | char *qry; | 439 | char *qry; |
| 436 | int err, ttl; | 440 | int err, ttl; |
| @@ -477,6 +481,8 @@ int main(int argc, const char **argv) | |||
| 477 | 481 | ||
| 478 | ttl = calc_ttl(); | 482 | ttl = calc_ttl(); |
| 479 | ctx.page.expires += ttl*60; | 483 | ctx.page.expires += ttl*60; |
| 484 | if (method && !strcmp(method, "HEAD")) | ||
| 485 | ctx.cfg.nocache = 1; | ||
| 480 | if (ctx.cfg.nocache) | 486 | if (ctx.cfg.nocache) |
| 481 | ctx.cfg.cache_size = 0; | 487 | ctx.cfg.cache_size = 0; |
| 482 | err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, | 488 | err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, |
