author | Lars Hjemli <hjemli@gmail.com> | 2009-07-25 09:59:22 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-07-25 09:59:22 (UTC) |
commit | 681fdc45473143de3f3c5f69fbc7b94f5d6b0b75 (patch) (unidiff) | |
tree | 3bfca05875524bee0e5444fb791707bc3e593dbd | |
parent | 7e5c048505efe1902fb476cc2cb3160ff7df013d (diff) | |
parent | 3ff58ddd51bcbcbc9b7649bad1a39aa98af4b49f (diff) | |
download | cgit-681fdc45473143de3f3c5f69fbc7b94f5d6b0b75.zip cgit-681fdc45473143de3f3c5f69fbc7b94f5d6b0b75.tar.gz cgit-681fdc45473143de3f3c5f69fbc7b94f5d6b0b75.tar.bz2 |
Merge branch 'plain-etag'
Conflicts:
ui-shared.c
-rw-r--r-- | cgit.c | 4 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-plain.c | 1 | ||||
-rw-r--r-- | ui-shared.c | 6 |
4 files changed, 12 insertions, 0 deletions
@@ -208,2 +208,3 @@ static void prepare_context(struct cgit_context *ctx) | |||
208 | ctx->page.expires = ctx->page.modified; | 208 | ctx->page.expires = ctx->page.modified; |
209 | ctx->page.etag = NULL; | ||
209 | } | 210 | } |
@@ -433,2 +434,3 @@ int main(int argc, const char **argv) | |||
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; |
@@ -479,2 +481,4 @@ int main(int argc, const char **argv) | |||
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) |
@@ -182,2 +182,3 @@ struct cgit_page { | |||
182 | char *filename; | 182 | char *filename; |
183 | char *etag; | ||
183 | char *title; | 184 | char *title; |
@@ -39,2 +39,3 @@ static void print_object(const unsigned char *sha1, const char *path) | |||
39 | ctx.page.size = size; | 39 | ctx.page.size = size; |
40 | ctx.page.etag = sha1_to_hex(sha1); | ||
40 | cgit_print_http_headers(&ctx); | 41 | cgit_print_http_headers(&ctx); |
diff --git a/ui-shared.c b/ui-shared.c index 29036d0..10be3c0 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -469,2 +469,4 @@ void cgit_print_http_headers(struct cgit_context *ctx) | |||
469 | { | 469 | { |
470 | const char *method = getenv("REQUEST_METHOD"); | ||
471 | |||
470 | if (ctx->page.status) | 472 | if (ctx->page.status) |
@@ -483,3 +485,7 @@ void cgit_print_http_headers(struct cgit_context *ctx) | |||
483 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); | 485 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); |
486 | if (ctx->page.etag) | ||
487 | htmlf("ETag: \"%s\"\n", ctx->page.etag); | ||
484 | html("\n"); | 488 | html("\n"); |
489 | if (method && !strcmp(method, "HEAD")) | ||
490 | exit(0); | ||
485 | } | 491 | } |