|
diff --git a/cgit.c b/cgit.c index 19adadd..ae20257 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -201,16 +201,17 @@ static void prepare_context(struct cgit_context *ctx) |
201 | ctx->cfg.summary_log = 10; |
201 | ctx->cfg.summary_log = 10; |
202 | ctx->cfg.summary_tags = 10; |
202 | ctx->cfg.summary_tags = 10; |
203 | ctx->page.mimetype = "text/html"; |
203 | ctx->page.mimetype = "text/html"; |
204 | ctx->page.charset = PAGE_ENCODING; |
204 | ctx->page.charset = PAGE_ENCODING; |
205 | ctx->page.filename = NULL; |
205 | ctx->page.filename = NULL; |
206 | ctx->page.size = 0; |
206 | ctx->page.size = 0; |
207 | ctx->page.modified = time(NULL); |
207 | ctx->page.modified = time(NULL); |
208 | ctx->page.expires = ctx->page.modified; |
208 | ctx->page.expires = ctx->page.modified; |
| |
209 | ctx->page.etag = NULL; |
209 | } |
210 | } |
210 | |
211 | |
211 | struct refmatch { |
212 | struct refmatch { |
212 | char *req_ref; |
213 | char *req_ref; |
213 | char *first_ref; |
214 | char *first_ref; |
214 | int match; |
215 | int match; |
215 | }; |
216 | }; |
216 | |
217 | |
@@ -426,16 +427,17 @@ static int calc_ttl() |
426 | return ctx.cfg.cache_static_ttl; |
427 | return ctx.cfg.cache_static_ttl; |
427 | |
428 | |
428 | return ctx.cfg.cache_repo_ttl; |
429 | return ctx.cfg.cache_repo_ttl; |
429 | } |
430 | } |
430 | |
431 | |
431 | int main(int argc, const char **argv) |
432 | int main(int argc, const char **argv) |
432 | { |
433 | { |
433 | const char *cgit_config_env = getenv("CGIT_CONFIG"); |
434 | const char *cgit_config_env = getenv("CGIT_CONFIG"); |
| |
435 | const char *method = getenv("REQUEST_METHOD"); |
434 | const char *path; |
436 | const char *path; |
435 | char *qry; |
437 | char *qry; |
436 | int err, ttl; |
438 | int err, ttl; |
437 | |
439 | |
438 | prepare_context(&ctx); |
440 | prepare_context(&ctx); |
439 | cgit_repolist.length = 0; |
441 | cgit_repolist.length = 0; |
440 | cgit_repolist.count = 0; |
442 | cgit_repolist.count = 0; |
441 | cgit_repolist.repos = NULL; |
443 | cgit_repolist.repos = NULL; |
@@ -472,16 +474,18 @@ int main(int argc, const char **argv) |
472 | free(qry); |
474 | free(qry); |
473 | } else |
475 | } else |
474 | ctx.qry.raw = ctx.qry.url; |
476 | ctx.qry.raw = ctx.qry.url; |
475 | cgit_parse_url(ctx.qry.url); |
477 | cgit_parse_url(ctx.qry.url); |
476 | } |
478 | } |
477 | |
479 | |
478 | ttl = calc_ttl(); |
480 | ttl = calc_ttl(); |
479 | ctx.page.expires += ttl*60; |
481 | ctx.page.expires += ttl*60; |
| |
482 | if (method && !strcmp(method, "HEAD")) |
| |
483 | ctx.cfg.nocache = 1; |
480 | if (ctx.cfg.nocache) |
484 | if (ctx.cfg.nocache) |
481 | ctx.cfg.cache_size = 0; |
485 | ctx.cfg.cache_size = 0; |
482 | err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, |
486 | err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, |
483 | ctx.qry.raw, ttl, process_request, &ctx); |
487 | ctx.qry.raw, ttl, process_request, &ctx); |
484 | if (err) |
488 | if (err) |
485 | cgit_print_error(fmt("Error processing page: %s (%d)", |
489 | cgit_print_error(fmt("Error processing page: %s (%d)", |
486 | strerror(err), err)); |
490 | strerror(err), err)); |
487 | return err; |
491 | return err; |
|