List for cgit developers and users
 help / color / mirror / Atom feed
From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: [PATCH] Return proper HTTP response when accessing info/
Date: Thu, 15 Jan 2015 19:47:42 +0100	[thread overview]
Message-ID: <1421347662-13281-1-git-send-email-cgit@cryptocrack.de> (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



             reply	other threads:[~2015-01-15 18:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 18:47 cgit [this message]
2015-01-15 18:49 ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421347662-13281-1-git-send-email-cgit@cryptocrack.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).