diff options
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 45 |
1 files changed, 25 insertions, 20 deletions
@@ -154,6 +154,10 @@ static void querystring_cb(const char *name, const char *value) | |||
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 | ||
@@ -435,28 +439,29 @@ int main(int argc, const char **argv) | |||
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 | path = getenv("PATH_INFO"); | 447 | |
448 | if (path) { | 448 | /* If no url parameter is specified on the querystring, lets |
449 | if (path[0] == '/') | 449 | * use PATH_INFO as url. This allows cgit to work with virtual |
450 | path++; | 450 | * urls without the need for rewriterules in the webserver (as |
451 | ctx.qry.url = xstrdup(path); | 451 | * long as PATH_INFO is included in the cache lookup key). |
452 | if (ctx.qry.raw) { | 452 | */ |
453 | qry = ctx.qry.raw; | 453 | path = getenv("PATH_INFO"); |
454 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | 454 | if (!ctx.qry.url && path) { |
455 | free(qry); | 455 | if (path[0] == '/') |
456 | } else | 456 | path++; |
457 | ctx.qry.raw = ctx.qry.url; | 457 | ctx.qry.url = xstrdup(path); |
458 | cgit_parse_url(ctx.qry.url); | 458 | if (ctx.qry.raw) { |
459 | } | 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); | ||
460 | } | 465 | } |
461 | 466 | ||
462 | ttl = calc_ttl(); | 467 | ttl = calc_ttl(); |