From mboxrd@z Thu Jan 1 00:00:00 1970 From: cgit at cryptocrack.de (Lukas Fleischer) Date: Thu, 15 Jan 2015 19:47:42 +0100 Subject: [PATCH] Return proper HTTP response when accessing info/ Message-ID: <1421347662-13281-1-git-send-email-cgit@cryptocrack.de> Currently, when a user directly accesses the info command of a repository, we exit cgit without printing anything to stdout, bringing up error messages like "502 Bad Gateway" or "An error occurred while reading CGI reply (no response received)". Instead of bailing out, at least print the HTTP headers, including a reasonable error message. Reported-by: Janus Troelsen Signed-off-by: Lukas Fleischer --- ui-clone.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-clone.c b/ui-clone.c index a4ffd6e..50569d6 100644 --- a/ui-clone.c +++ b/ui-clone.c @@ -71,8 +71,10 @@ static void send_file(char *path) void cgit_clone_info(void) { - if (!ctx.qry.path || strcmp(ctx.qry.path, "refs")) + if (!ctx.qry.path || strcmp(ctx.qry.path, "refs")) { + html_status(400, "Bad request", 0); return; + } ctx.page.mimetype = "text/plain"; ctx.page.filename = "info/refs"; -- 2.2.2