diff options
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | ui-shared.c | 2 |
3 files changed, 6 insertions, 0 deletions
@@ -285,6 +285,8 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
285 | if (get_sha1(ctx->qry.head, sha1)) { | 285 | if (get_sha1(ctx->qry.head, sha1)) { |
286 | tmp = xstrdup(ctx->qry.head); | 286 | tmp = xstrdup(ctx->qry.head); |
287 | ctx->qry.head = ctx->repo->defbranch; | 287 | ctx->qry.head = ctx->repo->defbranch; |
288 | ctx->page.status = 404; | ||
289 | ctx->page.statusmsg = "not found"; | ||
288 | cgit_print_http_headers(ctx); | 290 | cgit_print_http_headers(ctx); |
289 | cgit_print_docstart(ctx); | 291 | cgit_print_docstart(ctx); |
290 | cgit_print_pageheader(ctx); | 292 | cgit_print_pageheader(ctx); |
@@ -181,6 +181,8 @@ struct cgit_page { | |||
181 | char *charset; | 181 | char *charset; |
182 | char *filename; | 182 | char *filename; |
183 | char *title; | 183 | char *title; |
184 | int status; | ||
185 | char *statusmsg; | ||
184 | }; | 186 | }; |
185 | 187 | ||
186 | struct cgit_context { | 188 | struct cgit_context { |
diff --git a/ui-shared.c b/ui-shared.c index de77bbf..2630f23 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -456,6 +456,8 @@ void cgit_print_age(time_t t, time_t max_relative, char *format) | |||
456 | 456 | ||
457 | void cgit_print_http_headers(struct cgit_context *ctx) | 457 | void cgit_print_http_headers(struct cgit_context *ctx) |
458 | { | 458 | { |
459 | if (ctx->page.status) | ||
460 | htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg); | ||
459 | if (ctx->page.mimetype && ctx->page.charset) | 461 | if (ctx->page.mimetype && ctx->page.charset) |
460 | htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, | 462 | htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, |
461 | ctx->page.charset); | 463 | ctx->page.charset); |