about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--cgit.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/cgit.c b/cgit.c
index 166fbc6..d1cee58 100644
--- a/cgit.c
+++ b/cgit.c
@@ -439,28 +439,29 @@ int main(int argc, const char **argv)
 	ctx.repo = NULL;
 	http_parse_querystring(ctx.qry.raw, querystring_cb);
 
-	/* If virtual-root isn't specified in cgitrc and no url
-	 * parameter is specified on the querystring, lets pretend
-	 * that virtualroot equals SCRIPT_NAME and use PATH_INFO as
-	 * url. This allows cgit to work with virtual urls without
-	 * the need for rewriterules in the webserver (as long as
-	 * PATH_INFO is included in the cache lookup key).
+	/* If virtual-root isn't specified in cgitrc, lets pretend
+	 * that virtual-root equals SCRIPT_NAME.
 	 */
-	if (!ctx.cfg.virtual_root && !ctx.qry.url) {
+	if (!ctx.cfg.virtual_root)
 		ctx.cfg.virtual_root = ctx.cfg.script_name;
-		path = getenv("PATH_INFO");
-		if (path) {
-			if (path[0] == '/')
-				path++;
-			ctx.qry.url = xstrdup(path);
-			if (ctx.qry.raw) {
-				qry = ctx.qry.raw;
-				ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
-				free(qry);
-			} else
-				ctx.qry.raw = ctx.qry.url;
-			cgit_parse_url(ctx.qry.url);
-		}
+
+	/* If no url parameter is specified on the querystring, lets
+	 * use PATH_INFO as url. This allows cgit to work with virtual
+	 * urls without the need for rewriterules in the webserver (as
+	 * long as PATH_INFO is included in the cache lookup key).
+	 */
+	path = getenv("PATH_INFO");
+	if (!ctx.qry.url && path) {
+		if (path[0] == '/')
+			path++;
+		ctx.qry.url = xstrdup(path);
+		if (ctx.qry.raw) {
+			qry = ctx.qry.raw;
+			ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
+			free(qry);
+		} else
+			ctx.qry.raw = ctx.qry.url;
+		cgit_parse_url(ctx.qry.url);
 	}
 
 	ttl = calc_ttl();
mp;follow=1'>Set LANG in cgit filtersJune McEnroe ttpre needs to know about UTF-8 too so it can bold/italic non-ASCII chars. 2019-12-20Source .editrc before applying -v or -eJune McEnroe Otherwise a bind -v in .editrc will take precedence and overwrite the ^I binding for sh-complete. 2019-12-20Disable signing commitsJune McEnroe Why did I ever turn this on? This gets me nothing but inconvenience. RIP to all the wasted bytes in my git repos. 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe Hack: output an extra <td> after rendering mdoc so that line numbers can be hidden based on there being three. This required splitting source-filter and about-filter since on about pages there is no table. 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe :target persists after you click on something else. 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe NULs in the input cause an infinite loop in htmlEscape, not to mention regexes obviously not working, etc. 2019-12-16Post "cgit setup"June McEnroe