diff options
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 27 |
1 files changed, 7 insertions, 20 deletions
@@ -614,13 +614,8 @@ static int prepare_repo_cmd(void) | |||
614 | if (get_sha1(ctx.qry.head, sha1)) { | 614 | if (get_sha1(ctx.qry.head, sha1)) { |
615 | char *tmp = xstrdup(ctx.qry.head); | 615 | char *tmp = xstrdup(ctx.qry.head); |
616 | ctx.qry.head = ctx.repo->defbranch; | 616 | ctx.qry.head = ctx.repo->defbranch; |
617 | ctx.page.status = 404; | 617 | cgit_print_error_page(404, "Not found", |
618 | ctx.page.statusmsg = "Not found"; | 618 | "Invalid branch: %s", tmp); |
619 | cgit_print_http_headers(); | ||
620 | cgit_print_docstart(); | ||
621 | cgit_print_pageheader(); | ||
622 | cgit_print_error("Invalid branch: %s", tmp); | ||
623 | cgit_print_docend(); | ||
624 | free(tmp); | 619 | free(tmp); |
625 | return 1; | 620 | return 1; |
626 | } | 621 | } |
@@ -713,18 +708,13 @@ static void process_request(void) | |||
713 | cmd = cgit_get_cmd(); | 708 | cmd = cgit_get_cmd(); |
714 | if (!cmd) { | 709 | if (!cmd) { |
715 | ctx.page.title = "cgit error"; | 710 | ctx.page.title = "cgit error"; |
716 | ctx.page.status = 404; | 711 | cgit_print_error_page(404, "Not found", "Invalid request"); |
717 | ctx.page.statusmsg = "Not found"; | ||
718 | cgit_print_http_headers(); | ||
719 | cgit_print_docstart(); | ||
720 | cgit_print_pageheader(); | ||
721 | cgit_print_error("Invalid request"); | ||
722 | cgit_print_docend(); | ||
723 | return; | 712 | return; |
724 | } | 713 | } |
725 | 714 | ||
726 | if (!ctx.cfg.enable_http_clone && cmd->is_clone) { | 715 | if (!ctx.cfg.enable_http_clone && cmd->is_clone) { |
727 | html_status(404, "Not found", 0); | 716 | ctx.page.title = "cgit error"; |
717 | cgit_print_error_page(404, "Not found", "Invalid request"); | ||
728 | return; | 718 | return; |
729 | } | 719 | } |
730 | 720 | ||
@@ -735,11 +725,8 @@ static void process_request(void) | |||
735 | ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL; | 725 | ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL; |
736 | 726 | ||
737 | if (cmd->want_repo && !ctx.repo) { | 727 | if (cmd->want_repo && !ctx.repo) { |
738 | cgit_print_http_headers(); | 728 | cgit_print_error_page(400, "Bad request", |
739 | cgit_print_docstart(); | 729 | "No repository selected"); |
740 | cgit_print_pageheader(); | ||
741 | cgit_print_error("No repository selected"); | ||
742 | cgit_print_docend(); | ||
743 | return; | 730 | return; |
744 | } | 731 | } |
745 | 732 | ||