summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-03-22 20:31:35 +0100
committerFelix Fietkau <nbd@openwrt.org>2014-03-22 20:32:29 +0100
commitf9dad9ffdd41c00d1fc7420f2f55983c7f6df8bc (patch)
treefa1d4aefea25736e73e078ef9083b25664494c43 /main.c
parentd6366570bf706f3970b7f106a1ccd49b584559cf (diff)
cgi: compare the physical path instead of the url to detect quirky urls
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/main.c b/main.c
index e53a311..99a4025 100644
--- a/main.c
+++ b/main.c
@@ -183,6 +183,13 @@ static void init_defaults_post(void)
uh_index_add("index.htm");
uh_index_add("default.html");
uh_index_add("default.htm");
+
+ if (conf.cgi_prefix) {
+ char *str = malloc(strlen(conf.docroot) + strlen(conf.cgi_prefix) + 1);
+ strcpy(str, conf.docroot);
+ strcat(str, conf.cgi_prefix);
+ conf.cgi_docroot_path = str;
+ };
}
static void fixup_prefix(char *str)
@@ -406,12 +413,6 @@ int main(int argc, char **argv)
}
uh_config_parse();
- init_defaults_post();
-
- if (!bound) {
- fprintf(stderr, "Error: No sockets bound, unable to continue\n");
- return 1;
- }
if (!conf.docroot) {
if (!realpath(".", uh_buf)) {
@@ -421,6 +422,13 @@ int main(int argc, char **argv)
conf.docroot = strdup(uh_buf);
}
+ init_defaults_post();
+
+ if (!bound) {
+ fprintf(stderr, "Error: No sockets bound, unable to continue\n");
+ return 1;
+ }
+
#ifdef HAVE_TLS
if (n_tls) {
if (!tls_crt || !tls_key) {