|
diff --git a/cgit.c b/cgit.c index 6e5215e..f35f605 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) |
@@ -433,30 +437,31 @@ int main(int argc, const char **argv) |
433 | config_cb); |
437 | config_cb); |
434 | ctx.repo = NULL; |
438 | ctx.repo = NULL; |
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 | path = getenv("PATH_INFO"); |
446 | |
447 | if (path) { |
447 | /* If no url parameter is specified on the querystring, lets |
448 | if (path[0] == '/') |
448 | * use PATH_INFO as url. This allows cgit to work with virtual |
449 | path++; |
449 | * urls without the need for rewriterules in the webserver (as |
450 | ctx.qry.url = xstrdup(path); |
450 | * long as PATH_INFO is included in the cache lookup key). |
451 | if (ctx.qry.raw) { |
451 | */ |
452 | qry = ctx.qry.raw; |
452 | path = getenv("PATH_INFO"); |
453 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); |
453 | if (!ctx.qry.url && path) { |
454 | free(qry); |
454 | if (path[0] == '/') |
455 | } else |
455 | path++; |
456 | ctx.qry.raw = ctx.qry.url; |
456 | ctx.qry.url = xstrdup(path); |
457 | cgit_parse_url(ctx.qry.url); |
457 | if (ctx.qry.raw) { |
458 | } |
458 | qry = ctx.qry.raw; |
| |
459 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); |
| |
460 | free(qry); |
| |
461 | } else |
| |
462 | ctx.qry.raw = ctx.qry.url; |
| |
463 | cgit_parse_url(ctx.qry.url); |
459 | } |
464 | } |
460 | |
465 | |
461 | ttl = calc_ttl(); |
466 | ttl = calc_ttl(); |
462 | ctx.page.expires += ttl*60; |
467 | ctx.page.expires += ttl*60; |
|