aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer2015-01-15 19:47:42 +0100
committerJason A. Donenfeld2015-01-15 19:48:44 +0100
commited7e3bc822856c30066a4ff0178033b22046fe96 (patch)
treed0cfb14346d8f14f5dbb0ae75fe5071013666b19
parentc641e0ab64f447cd39c6d5737fd498ace3ed8735 (diff)
downloadcgit-ed7e3bc822856c30066a4ff0178033b22046fe96.tar.gz
cgit-ed7e3bc822856c30066a4ff0178033b22046fe96.tar.bz2
cgit-ed7e3bc822856c30066a4ff0178033b22046fe96.zip
Return proper HTTP response when accessing info/
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>
-rw-r--r--ui-clone.c4
1 files changed, 3 insertions, 1 deletions
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)
71 71
72void cgit_clone_info(void) 72void cgit_clone_info(void)
73{ 73{
74 if (!ctx.qry.path || strcmp(ctx.qry.path, "refs")) 74 if (!ctx.qry.path || strcmp(ctx.qry.path, "refs")) {
75 html_status(400, "Bad request", 0);
75 return; 76 return;
77 }
76 78
77 ctx.page.mimetype = "text/plain"; 79 ctx.page.mimetype = "text/plain";
78 ctx.page.filename = "info/refs"; 80 ctx.page.filename = "info/refs";