summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2009-07-25 09:59:22 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-07-25 09:59:22 (UTC)
commit681fdc45473143de3f3c5f69fbc7b94f5d6b0b75 (patch) (side-by-side diff)
tree3bfca05875524bee0e5444fb791707bc3e593dbd /cgit.c
parent7e5c048505efe1902fb476cc2cb3160ff7df013d (diff)
parent3ff58ddd51bcbcbc9b7649bad1a39aa98af4b49f (diff)
downloadcgit-681fdc45473143de3f3c5f69fbc7b94f5d6b0b75.zip
cgit-681fdc45473143de3f3c5f69fbc7b94f5d6b0b75.tar.gz
cgit-681fdc45473143de3f3c5f69fbc7b94f5d6b0b75.tar.bz2
Merge branch 'plain-etag'
Conflicts: ui-shared.c
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 19adadd..ae20257 100644
--- a/cgit.c
+++ b/cgit.c
@@ -203,12 +203,13 @@ static void prepare_context(struct cgit_context *ctx)
ctx->page.mimetype = "text/html";
ctx->page.charset = PAGE_ENCODING;
ctx->page.filename = NULL;
ctx->page.size = 0;
ctx->page.modified = time(NULL);
ctx->page.expires = ctx->page.modified;
+ ctx->page.etag = NULL;
}
struct refmatch {
char *req_ref;
char *first_ref;
int match;
@@ -428,12 +429,13 @@ static int calc_ttl()
return ctx.cfg.cache_repo_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;
prepare_context(&ctx);
cgit_repolist.length = 0;
@@ -474,12 +476,14 @@ int main(int argc, const char **argv)
ctx.qry.raw = ctx.qry.url;
cgit_parse_url(ctx.qry.url);
}
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,
ctx.qry.raw, ttl, process_request, &ctx);
if (err)
cgit_print_error(fmt("Error processing page: %s (%d)",