]> granicus.if.org Git - cgit/commitdiff
Return proper HTTP response when accessing info/
authorLukas Fleischer <cgit@cryptocrack.de>
Thu, 15 Jan 2015 18:47:42 +0000 (19:47 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 15 Jan 2015 18:48:44 +0000 (19:48 +0100)
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 <cgit@cryptocrack.de>
ui-clone.c

index a4ffd6e06bfe1f371cec2221813e1d0b7b5be084..50569d6075f6ef94a3c4ebbd465ff648fb5b7486 100644 (file)
@@ -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";