about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--cgit.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/cgit.c b/cgit.c
index d84b4be..3a97563 100644
--- a/cgit.c
+++ b/cgit.c
@@ -614,13 +614,8 @@ static int prepare_repo_cmd(void)
 	if (get_sha1(ctx.qry.head, sha1)) {
 		char *tmp = xstrdup(ctx.qry.head);
 		ctx.qry.head = ctx.repo->defbranch;
-		ctx.page.status = 404;
-		ctx.page.statusmsg = "Not found";
-		cgit_print_http_headers();
-		cgit_print_docstart();
-		cgit_print_pageheader();
-		cgit_print_error("Invalid branch: %s", tmp);
-		cgit_print_docend();
+		cgit_print_error_page(404, "Not found",
+				"Invalid branch: %s", tmp);
 		free(tmp);
 		return 1;
 	}
@@ -713,18 +708,13 @@ static void process_request(void)
 	cmd = cgit_get_cmd();
 	if (!cmd) {
 		ctx.page.title = "cgit error";
-		ctx.page.status = 404;
-		ctx.page.statusmsg = "Not found";
-		cgit_print_http_headers();
-		cgit_print_docstart();
-		cgit_print_pageheader();
-		cgit_print_error("Invalid request");
-		cgit_print_docend();
+		cgit_print_error_page(404, "Not found", "Invalid request");
 		return;
 	}
 
 	if (!ctx.cfg.enable_http_clone && cmd->is_clone) {
-		html_status(404, "Not found", 0);
+		ctx.page.title = "cgit error";
+		cgit_print_error_page(404, "Not found", "Invalid request");
 		return;
 	}
 
@@ -735,11 +725,8 @@ static void process_request(void)
 	ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL;
 
 	if (cmd->want_repo && !ctx.repo) {
-		cgit_print_http_headers();
-		cgit_print_docstart();
-		cgit_print_pageheader();
-		cgit_print_error("No repository selected");
-		cgit_print_docend();
+		cgit_print_error_page(400, "Bad request",
+				"No repository selected");
 		return;
 	}
 
class='logheader'>2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe This is actually possible with use_default_colors! 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe Fall back to using bold if there are only 8 colors. This also allowed bright background colors in 16-color terminals. I must port this system to torus. I'll be able to remove the awful termcap patch hack. 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe Oh boy that's embarrassing. 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe Don't really have a way to implement the M-* keys, and currently missing C-w. 2018-08-04Handle /topicJune McEnroe