all repos — cgit @ ed7e3bc822856c30066a4ff0178033b22046fe96

a hyperfast web frontend for git written in c

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>
Lukas Fleischer cgit@cryptocrack.de
Thu, 15 Jan 2015 19:47:42 +0100
commit

ed7e3bc822856c30066a4ff0178033b22046fe96

parent

c641e0ab64f447cd39c6d5737fd498ace3ed8735

1 files changed, 3 insertions(+), 1 deletions(-)

jump to
M ui-clone.cui-clone.c

@@ -71,8 +71,10 @@ }

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";