summaryrefslogtreecommitdiffabout
path: root/cgit.c
Side-by-side diff
Diffstat (limited to 'cgit.c') (more/less context) (show whitespace changes)
-rw-r--r--cgit.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/cgit.c b/cgit.c
index 6e5215e..f35f605 100644
--- a/cgit.c
+++ b/cgit.c
@@ -155,4 +155,8 @@ static void querystring_cb(const char *name, const char *value)
} else if (!strcmp(name, "mimetype")) {
ctx.qry.mimetype = xstrdup(value);
+ } else if (!strcmp(name, "s")){
+ ctx.qry.sort = xstrdup(value);
+ } else if (!strcmp(name, "showmsg")) {
+ ctx.qry.showmsg = atoi(value);
}
}
@@ -435,15 +439,17 @@ int main(int argc, const char **argv)
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++;
@@ -457,5 +463,4 @@ int main(int argc, const char **argv)
cgit_parse_url(ctx.qry.url);
}
- }
ttl = calc_ttl();