mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
Merge branch 'lh/virtual-root'
This commit is contained in:
commit
ef688e16f0
19
cgit.c
19
cgit.c
@ -439,17 +439,19 @@ 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;
|
||||
|
||||
/* 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);
|
||||
@ -461,7 +463,6 @@ int main(int argc, const char **argv)
|
||||
ctx.qry.raw = ctx.qry.url;
|
||||
cgit_parse_url(ctx.qry.url);
|
||||
}
|
||||
}
|
||||
|
||||
ttl = calc_ttl();
|
||||
ctx.page.expires += ttl*60;
|
||||
|
Loading…
Reference in New Issue
Block a user