|
diff --git a/cgit.c b/cgit.c index c82587b..d1cee58 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -153,8 +153,12 @@ static void querystring_cb(const char *name, const char *value) |
153 | } else if (!strcmp(name, "name")) { |
153 | } else if (!strcmp(name, "name")) { |
154 | ctx.qry.name = xstrdup(value); |
154 | ctx.qry.name = xstrdup(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 | } |
159 | |
163 | |
160 | static void prepare_context(struct cgit_context *ctx) |
164 | static void prepare_context(struct cgit_context *ctx) |
@@ -434,19 +438,21 @@ int main(int argc, const char **argv) |
434 | config_cb); |
438 | config_cb); |
435 | ctx.repo = NULL; |
439 | ctx.repo = NULL; |
436 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
440 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
437 | |
441 | |
438 | /* If virtual-root isn't specified in cgitrc and no url |
442 | /* If virtual-root isn't specified in cgitrc, lets pretend |
439 | * parameter is specified on the querystring, lets pretend |
443 | * that virtual-root equals SCRIPT_NAME. |
440 | * that virtualroot equals SCRIPT_NAME and use PATH_INFO as |
| |
441 | * url. This allows cgit to work with virtual urls without |
| |
442 | * the need for rewriterules in the webserver (as long as |
| |
443 | * PATH_INFO is included in the cache lookup key). |
| |
444 | */ |
444 | */ |
445 | if (!ctx.cfg.virtual_root && !ctx.qry.url) { |
445 | if (!ctx.cfg.virtual_root) |
446 | ctx.cfg.virtual_root = ctx.cfg.script_name; |
446 | ctx.cfg.virtual_root = ctx.cfg.script_name; |
| |
447 | |
| |
448 | /* If no url parameter is specified on the querystring, lets |
| |
449 | * use PATH_INFO as url. This allows cgit to work with virtual |
| |
450 | * urls without the need for rewriterules in the webserver (as |
| |
451 | * long as PATH_INFO is included in the cache lookup key). |
| |
452 | */ |
447 | path = getenv("PATH_INFO"); |
453 | path = getenv("PATH_INFO"); |
448 | if (path) { |
454 | if (!ctx.qry.url && path) { |
449 | if (path[0] == '/') |
455 | if (path[0] == '/') |
450 | path++; |
456 | path++; |
451 | ctx.qry.url = xstrdup(path); |
457 | ctx.qry.url = xstrdup(path); |
452 | if (ctx.qry.raw) { |
458 | if (ctx.qry.raw) { |
@@ -456,9 +462,8 @@ int main(int argc, const char **argv) |
456 | } else |
462 | } else |
457 | ctx.qry.raw = ctx.qry.url; |
463 | ctx.qry.raw = ctx.qry.url; |
458 | cgit_parse_url(ctx.qry.url); |
464 | cgit_parse_url(ctx.qry.url); |
459 | } |
465 | } |
460 | } |
| |
461 | |
466 | |
462 | ttl = calc_ttl(); |
467 | ttl = calc_ttl(); |
463 | ctx.page.expires += ttl*60; |
468 | ctx.page.expires += ttl*60; |
464 | if (ctx.cfg.nocache) |
469 | if (ctx.cfg.nocache) |
|