|
diff --git a/cgit.c b/cgit.c index 57e11cd..608cab6 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -158,8 +158,12 @@ static void querystring_cb(const char *name, const char *value) |
158 | } else if (!strcmp(name, "name")) { |
158 | } else if (!strcmp(name, "name")) { |
159 | ctx.qry.name = xstrdup(value); |
159 | ctx.qry.name = xstrdup(value); |
160 | } else if (!strcmp(name, "mimetype")) { |
160 | } else if (!strcmp(name, "mimetype")) { |
161 | ctx.qry.mimetype = xstrdup(value); |
161 | ctx.qry.mimetype = xstrdup(value); |
| |
162 | } else if (!strcmp(name, "s")){ |
| |
163 | ctx.qry.sort = xstrdup(value); |
| |
164 | } else if (!strcmp(name, "showmsg")) { |
| |
165 | ctx.qry.showmsg = atoi(value); |
162 | } else if (!strcmp(name, "period")) { |
166 | } else if (!strcmp(name, "period")) { |
163 | ctx.qry.period = xstrdup(value); |
167 | ctx.qry.period = xstrdup(value); |
164 | } |
168 | } |
165 | } |
169 | } |
@@ -296,9 +300,8 @@ static void process_request(void *cbdata) |
296 | |
300 | |
297 | cmd = cgit_get_cmd(ctx); |
301 | cmd = cgit_get_cmd(ctx); |
298 | if (!cmd) { |
302 | if (!cmd) { |
299 | ctx->page.title = "cgit error"; |
303 | ctx->page.title = "cgit error"; |
300 | ctx->repo = NULL; |
| |
301 | cgit_print_http_headers(ctx); |
304 | cgit_print_http_headers(ctx); |
302 | cgit_print_docstart(ctx); |
305 | cgit_print_docstart(ctx); |
303 | cgit_print_pageheader(ctx); |
306 | cgit_print_pageheader(ctx); |
304 | cgit_print_error("Invalid request"); |
307 | cgit_print_error("Invalid request"); |
@@ -442,19 +445,21 @@ int main(int argc, const char **argv) |
442 | config_cb); |
445 | config_cb); |
443 | ctx.repo = NULL; |
446 | ctx.repo = NULL; |
444 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
447 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
445 | |
448 | |
446 | /* If virtual-root isn't specified in cgitrc and no url |
449 | /* If virtual-root isn't specified in cgitrc, lets pretend |
447 | * parameter is specified on the querystring, lets pretend |
450 | * that virtual-root equals SCRIPT_NAME. |
448 | * that virtualroot equals SCRIPT_NAME and use PATH_INFO as |
| |
449 | * url. This allows cgit to work with virtual urls without |
| |
450 | * the need for rewriterules in the webserver (as long as |
| |
451 | * PATH_INFO is included in the cache lookup key). |
| |
452 | */ |
451 | */ |
453 | if (!ctx.cfg.virtual_root && !ctx.qry.url) { |
452 | if (!ctx.cfg.virtual_root) |
454 | ctx.cfg.virtual_root = ctx.cfg.script_name; |
453 | ctx.cfg.virtual_root = ctx.cfg.script_name; |
| |
454 | |
| |
455 | /* If no url parameter is specified on the querystring, lets |
| |
456 | * use PATH_INFO as url. This allows cgit to work with virtual |
| |
457 | * urls without the need for rewriterules in the webserver (as |
| |
458 | * long as PATH_INFO is included in the cache lookup key). |
| |
459 | */ |
455 | path = getenv("PATH_INFO"); |
460 | path = getenv("PATH_INFO"); |
456 | if (path) { |
461 | if (!ctx.qry.url && path) { |
457 | if (path[0] == '/') |
462 | if (path[0] == '/') |
458 | path++; |
463 | path++; |
459 | ctx.qry.url = xstrdup(path); |
464 | ctx.qry.url = xstrdup(path); |
460 | if (ctx.qry.raw) { |
465 | if (ctx.qry.raw) { |
@@ -464,9 +469,8 @@ int main(int argc, const char **argv) |
464 | } else |
469 | } else |
465 | ctx.qry.raw = ctx.qry.url; |
470 | ctx.qry.raw = ctx.qry.url; |
466 | cgit_parse_url(ctx.qry.url); |
471 | cgit_parse_url(ctx.qry.url); |
467 | } |
472 | } |
468 | } |
| |
469 | |
473 | |
470 | ttl = calc_ttl(); |
474 | ttl = calc_ttl(); |
471 | ctx.page.expires += ttl*60; |
475 | ctx.page.expires += ttl*60; |
472 | if (ctx.cfg.nocache) |
476 | if (ctx.cfg.nocache) |
|