summaryrefslogtreecommitdiffabout
path: root/cgit.c
Unidiff
Diffstat (limited to 'cgit.c') (more/less context) (show whitespace changes)
-rw-r--r--cgit.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/cgit.c b/cgit.c
index 6e5215e..f35f605 100644
--- a/cgit.c
+++ b/cgit.c
@@ -155,4 +155,8 @@ static void querystring_cb(const char *name, const char *value)
155 } else if (!strcmp(name, "mimetype")) { 155 } else if (!strcmp(name, "mimetype")) {
156 ctx.qry.mimetype = xstrdup(value); 156 ctx.qry.mimetype = xstrdup(value);
157 } else if (!strcmp(name, "s")){
158 ctx.qry.sort = xstrdup(value);
159 } else if (!strcmp(name, "showmsg")) {
160 ctx.qry.showmsg = atoi(value);
157 } 161 }
158} 162}
@@ -435,15 +439,17 @@ int main(int argc, const char **argv)
435 http_parse_querystring(ctx.qry.raw, querystring_cb); 439 http_parse_querystring(ctx.qry.raw, querystring_cb);
436 440
437 /* If virtual-root isn't specified in cgitrc and no url 441 /* If virtual-root isn't specified in cgitrc, lets pretend
438 * parameter is specified on the querystring, lets pretend 442 * that virtual-root equals SCRIPT_NAME.
439 * that virtualroot equals SCRIPT_NAME and use PATH_INFO as
440 * url. This allows cgit to work with virtual urls without
441 * the need for rewriterules in the webserver (as long as
442 * PATH_INFO is included in the cache lookup key).
443 */ 443 */
444 if (!ctx.cfg.virtual_root && !ctx.qry.url) { 444 if (!ctx.cfg.virtual_root)
445 ctx.cfg.virtual_root = ctx.cfg.script_name; 445 ctx.cfg.virtual_root = ctx.cfg.script_name;
446
447 /* If no url parameter is specified on the querystring, lets
448 * use PATH_INFO as url. This allows cgit to work with virtual
449 * urls without the need for rewriterules in the webserver (as
450 * long as PATH_INFO is included in the cache lookup key).
451 */
446 path = getenv("PATH_INFO"); 452 path = getenv("PATH_INFO");
447 if (path) { 453 if (!ctx.qry.url && path) {
448 if (path[0] == '/') 454 if (path[0] == '/')
449 path++; 455 path++;
@@ -457,5 +463,4 @@ int main(int argc, const char **argv)
457 cgit_parse_url(ctx.qry.url); 463 cgit_parse_url(ctx.qry.url);
458 } 464 }
459 }
460 465
461 ttl = calc_ttl(); 466 ttl = calc_ttl();