author | Lars Hjemli <hjemli@gmail.com> | 2011-03-05 13:01:59 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2011-03-05 13:01:59 (UTC) |
commit | 1b09cbd303d889ec2636127584d57b7f1b70c25e (patch) (unidiff) | |
tree | 2b1188f946451d06af4d9120cbc3ba34de716f21 /cgit.c | |
parent | 979c460e7f71d153ae79da67b8b21c3412f0fe02 (diff) | |
parent | 9e849950dc7c1f2fb6ffa62ab65bd30f35717d13 (diff) | |
download | cgit-1b09cbd303d889ec2636127584d57b7f1b70c25e.zip cgit-1b09cbd303d889ec2636127584d57b7f1b70c25e.tar.gz cgit-1b09cbd303d889ec2636127584d57b7f1b70c25e.tar.bz2 |
Merge branch 'stable'
-rw-r--r-- | cgit.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -739,36 +739,37 @@ int main(int argc, const char **argv) | |||
739 | { | 739 | { |
740 | const char *path; | 740 | const char *path; |
741 | char *qry; | 741 | char *qry; |
742 | int err, ttl; | 742 | int err, ttl; |
743 | 743 | ||
744 | prepare_context(&ctx); | 744 | prepare_context(&ctx); |
745 | cgit_repolist.length = 0; | 745 | cgit_repolist.length = 0; |
746 | cgit_repolist.count = 0; | 746 | cgit_repolist.count = 0; |
747 | cgit_repolist.repos = NULL; | 747 | cgit_repolist.repos = NULL; |
748 | 748 | ||
749 | cgit_parse_args(argc, argv); | 749 | cgit_parse_args(argc, argv); |
750 | parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); | 750 | parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); |
751 | ctx.repo = NULL; | 751 | ctx.repo = NULL; |
752 | http_parse_querystring(ctx.qry.raw, querystring_cb); | 752 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
753 | 753 | ||
754 | /* If virtual-root isn't specified in cgitrc, lets pretend | 754 | /* If virtual-root isn't specified in cgitrc, lets pretend |
755 | * that virtual-root equals SCRIPT_NAME. | 755 | * that virtual-root equals SCRIPT_NAME, minus any possibly |
756 | * trailing slashes. | ||
756 | */ | 757 | */ |
757 | if (!ctx.cfg.virtual_root) | 758 | if (!ctx.cfg.virtual_root) |
758 | ctx.cfg.virtual_root = ctx.cfg.script_name; | 759 | ctx.cfg.virtual_root = trim_end(ctx.cfg.script_name, '/'); |
759 | 760 | ||
760 | /* If no url parameter is specified on the querystring, lets | 761 | /* If no url parameter is specified on the querystring, lets |
761 | * use PATH_INFO as url. This allows cgit to work with virtual | 762 | * use PATH_INFO as url. This allows cgit to work with virtual |
762 | * urls without the need for rewriterules in the webserver (as | 763 | * urls without the need for rewriterules in the webserver (as |
763 | * long as PATH_INFO is included in the cache lookup key). | 764 | * long as PATH_INFO is included in the cache lookup key). |
764 | */ | 765 | */ |
765 | path = ctx.env.path_info; | 766 | path = ctx.env.path_info; |
766 | if (!ctx.qry.url && path) { | 767 | if (!ctx.qry.url && path) { |
767 | if (path[0] == '/') | 768 | if (path[0] == '/') |
768 | path++; | 769 | path++; |
769 | ctx.qry.url = xstrdup(path); | 770 | ctx.qry.url = xstrdup(path); |
770 | if (ctx.qry.raw) { | 771 | if (ctx.qry.raw) { |
771 | qry = ctx.qry.raw; | 772 | qry = ctx.qry.raw; |
772 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | 773 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); |
773 | free(qry); | 774 | free(qry); |
774 | } else | 775 | } else |