summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2009-01-11 11:22:19 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-01-11 11:22:19 (UTC)
commitef688e16f05a5a3438e63645852c436fe33fab71 (patch) (side-by-side diff)
treece8a47002822f1b75589d21da7b44c59cfd2c051
parentd1c48e513975c9099406c0cd53f38cfd6f56d347 (diff)
parent377a1c8cedcbd18f42e45c6ab757a603af44df33 (diff)
downloadcgit-ef688e16f05a5a3438e63645852c436fe33fab71.zip
cgit-ef688e16f05a5a3438e63645852c436fe33fab71.tar.gz
cgit-ef688e16f05a5a3438e63645852c436fe33fab71.tar.bz2
Merge branch 'lh/virtual-root'
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cgit.c b/cgit.c
index 166fbc6..d1cee58 100644
--- a/cgit.c
+++ b/cgit.c
@@ -438,19 +438,21 @@ int main(int argc, const char **argv)
config_cb);
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;
+
+ /* 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 (path) {
+ if (!ctx.qry.url && path) {
if (path[0] == '/')
path++;
ctx.qry.url = xstrdup(path);
if (ctx.qry.raw) {
@@ -460,9 +462,8 @@ int main(int argc, const char **argv)
} else
ctx.qry.raw = ctx.qry.url;
cgit_parse_url(ctx.qry.url);
}
- }
ttl = calc_ttl();
ctx.page.expires += ttl*60;
if (ctx.cfg.nocache)