diff options
author | Lars Hjemli <hjemli@gmail.com> | 2009-01-11 20:22:19 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-01-11 20:22:19 (JST) |
commit | ef688e16f05a5a3438e63645852c436fe33fab71 (patch) | |
tree | ce8a47002822f1b75589d21da7b44c59cfd2c051 | |
parent | d1c48e513975c9099406c0cd53f38cfd6f56d347 (diff) | |
parent | 377a1c8cedcbd18f42e45c6ab757a603af44df33 (diff) | |
download | cgit-ef688e16f05a5a3438e63645852c436fe33fab71.zip cgit-ef688e16f05a5a3438e63645852c436fe33fab71.tar.gz |
Merge branch 'lh/virtual-root'
-rw-r--r-- | cgit.c | 41 |
1 files changed, 21 insertions, 20 deletions
@@ -439,28 +439,29 @@ int main(int argc, const char **argv) | |||
439 | ctx.repo = NULL; | 439 | ctx.repo = NULL; |
440 | http_parse_querystring(ctx.qry.raw, querystring_cb); | 440 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
441 | 441 | ||
442 | /* If virtual-root isn't specified in cgitrc and no url | 442 | /* If virtual-root isn't specified in cgitrc, lets pretend |
443 | * parameter is specified on the querystring, lets pretend | 443 | * that virtual-root equals SCRIPT_NAME. |
444 | * that virtualroot equals SCRIPT_NAME and use PATH_INFO as | ||
445 | * url. This allows cgit to work with virtual urls without | ||
446 | * the need for rewriterules in the webserver (as long as | ||
447 | * PATH_INFO is included in the cache lookup key). | ||
448 | */ | 444 | */ |
449 | if (!ctx.cfg.virtual_root && !ctx.qry.url) { | 445 | if (!ctx.cfg.virtual_root) |
450 | ctx.cfg.virtual_root = ctx.cfg.script_name; | 446 | ctx.cfg.virtual_root = ctx.cfg.script_name; |
451 | path = getenv("PATH_INFO"); | 447 | |
452 | if (path) { | 448 | /* If no url parameter is specified on the querystring, lets |
453 | if (path[0] == '/') | 449 | * use PATH_INFO as url. This allows cgit to work with virtual |
454 | path++; | 450 | * urls without the need for rewriterules in the webserver (as |
455 | ctx.qry.url = xstrdup(path); | 451 | * long as PATH_INFO is included in the cache lookup key). |
456 | if (ctx.qry.raw) { | 452 | */ |
457 | qry = ctx.qry.raw; | 453 | path = getenv("PATH_INFO"); |
458 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | 454 | if (!ctx.qry.url && path) { |
459 | free(qry); | 455 | if (path[0] == '/') |
460 | } else | 456 | path++; |
461 | ctx.qry.raw = ctx.qry.url; | 457 | ctx.qry.url = xstrdup(path); |
462 | cgit_parse_url(ctx.qry.url); | 458 | if (ctx.qry.raw) { |
463 | } | 459 | qry = ctx.qry.raw; |
460 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | ||
461 | free(qry); | ||
462 | } else | ||
463 | ctx.qry.raw = ctx.qry.url; | ||
464 | cgit_parse_url(ctx.qry.url); | ||
464 | } | 465 | } |
465 | 466 | ||
466 | ttl = calc_ttl(); | 467 | ttl = calc_ttl(); |