List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] Return proper HTTP response when accessing info/
@ 2015-01-15 18:47 cgit
  2015-01-15 18:49 ` Jason
  0 siblings, 1 reply; 2+ messages in thread
From: cgit @ 2015-01-15 18:47 UTC (permalink / raw)


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 at cryptocrack.de>
---
 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Return proper HTTP response when accessing info/
  2015-01-15 18:47 [PATCH] Return proper HTTP response when accessing info/ cgit
@ 2015-01-15 18:49 ` Jason
  0 siblings, 0 replies; 2+ messages in thread
From: Jason @ 2015-01-15 18:49 UTC (permalink / raw)


Good thinkin, Lincoln.

Merged.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20150115/c55604c6/attachment.html>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-15 18:47 [PATCH] Return proper HTTP response when accessing info/ cgit
2015-01-15 18:49 ` Jason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).