From 121898e73d6e28656c2d451effc6d9907ebdc5ba Mon Sep 17 00:00:00 2001
From: Stefan Bühler <source@stbuehler.de>
Date: Mon, 14 Sep 2009 21:37:13 +0000
Subject: Skip leading "/" in url querystring value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Makes it easier to rewrite :)
lighttpd-sandbox: rewrite "/cgit.cgi?url=%{enc:request.path}&%{request.query}";

Signed-off-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 cgit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cgit.c b/cgit.c
index bd37788..a17f40d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -209,6 +209,8 @@ static void querystring_cb(const char *name, const char *value)
 	} else if (!strcmp(name, "p")) {
 		ctx.qry.page = xstrdup(value);
 	} else if (!strcmp(name, "url")) {
+		if (*value == '/')
+			value++;
 		ctx.qry.url = xstrdup(value);
 		cgit_parse_url(value);
 	} else if (!strcmp(name, "qt")) {
-- 
cgit 1.3.0-6-gf8a5