X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/694dd43886f23723f415aed3afb62131cdbcaa51..681fdc45473143de3f3c5f69fbc7b94f5d6b0b75:/ui-shared.c diff --git a/ui-shared.c b/ui-shared.c index 5ce2bc5..10be3c0 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -467,6 +467,10 @@ void cgit_print_age(time_t t, time_t max_relative, char *format) 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); @@ -479,7 +483,11 @@ void cgit_print_http_headers(struct cgit_context *ctx) ctx->page.filename); htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); htmlf("Expires: %s\n", http_date(ctx->page.expires)); + if (ctx->page.etag) + htmlf("ETag: \"%s\"\n", ctx->page.etag); html("\n"); + if (method && !strcmp(method, "HEAD")) + exit(0); } void cgit_print_docstart(struct cgit_context *ctx)