]> git.cameronkatri.com Git - cgit.git/commitdiff
Merge branch 'plain-etag'
authorLars Hjemli <hjemli@gmail.com>
Sat, 25 Jul 2009 09:59:22 +0000 (11:59 +0200)
committerLars Hjemli <hjemli@gmail.com>
Sat, 25 Jul 2009 09:59:22 +0000 (11:59 +0200)
Conflicts:
ui-shared.c

1  2 
cgit.c
cgit.h
ui-plain.c
ui-shared.c

diff --cc cgit.c
Simple merge
diff --cc cgit.h
index 00aca4c36a46d6dc8737b32ea794c917dcfc825e,2bfbe7b0007ae65939cf972bd9cd3eb3093fef48..07a277a3e727b93b64623d4fa366ac3131486bdd
--- 1/cgit.h
--- 2/cgit.h
+++ b/cgit.h
@@@ -180,9 -180,8 +180,10 @@@ struct cgit_page 
        char *mimetype;
        char *charset;
        char *filename;
+       char *etag;
        char *title;
 +      int status;
 +      char *statusmsg;
  };
  
  struct cgit_context {
diff --cc ui-plain.c
index 9a9ae7d5a80ccea3db7bea37a69405ca60e56edd,f73cd14e8e56e3b080fe73a647c5ff91ed2f58ed..93a3a05ac50f7a43b3c50529a011f0c9fdbf547c
@@@ -31,12 -31,10 +31,13 @@@ static void print_object(const unsigne
                html_status(404, "Not found", 0);
                return;
        }
 -      ctx.page.mimetype = "text/plain";
 +      if (buffer_is_binary(buf, size))
 +              ctx.page.mimetype = "application/octet-stream";
 +      else
 +              ctx.page.mimetype = "text/plain";
        ctx.page.filename = fmt("%s", path);
        ctx.page.size = size;
+       ctx.page.etag = sha1_to_hex(sha1);
        cgit_print_http_headers(&ctx);
        html_raw(buf, size);
        match = 1;
diff --cc ui-shared.c
index 29036d0a92ba45643e7db53af2671113fcbff7be,0dafc836736c1c8f165deb167c7b3a6f83302e0f..10be3c057dab494ad9782220374d0df258247cf0
@@@ -467,8 -456,8 +467,10 @@@ void cgit_print_age(time_t t, time_t ma
  
  void cgit_print_http_headers(struct cgit_context *ctx)
  {
+       const char *method = getenv("REQUEST_METHOD");
 +      if (ctx->page.status)
 +              htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg);
        if (ctx->page.mimetype && ctx->page.charset)
                htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype,
                      ctx->page.charset);