diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-10-31 01:34:37 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-10-31 01:34:37 +0000 |
commit | ac54bede6aa6953253d1b04443c5bc6062676060 (patch) | |
tree | fb6e8e05261dcdc4a3f5a339e8dc8bec4af5a823 /src/tipideed | |
parent | 28e7bfc363aefc591955794e9c031f6962274368 (diff) | |
download | tipidee-ac54bede6aa6953253d1b04443c5bc6062676060.tar.xz |
Some bugfixes
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/tipideed')
-rw-r--r-- | src/tipideed/cgi.c | 2 | ||||
-rw-r--r-- | src/tipideed/responses.c | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/tipideed/cgi.c b/src/tipideed/cgi.c index 43fb98d..3319099 100644 --- a/src/tipideed/cgi.c +++ b/src/tipideed/cgi.c @@ -209,7 +209,7 @@ static inline int run_cgi (tipidee_rql const *rql, char const *docroot, char con rstate = 1 ; break ; } - case 400 : die502x(rql, 2, docroot, "invalid headers", " from cgi ", argv[0]) ; + case 400 : die502x(rql, 2, docroot, "invalid output", " from cgi ", argv[0]) ; case 413 : die502x(rql, 2, docroot, hdr->n >= TIPIDEE_HEADERS_MAX ? "Too many headers" : "Too much header data", " from cgi ", argv[0]) ; case 500 : die500x(rql, 101, docroot, "can't happen: ", "avltreen_insert failed", " in do_cgi") ; default : die500x(rql, 101, docroot, "can't happen: ", "unknown tipidee_headers_parse return code", " in do_cgi") ; diff --git a/src/tipideed/responses.c b/src/tipideed/responses.c index f08f83c..ec58622 100644 --- a/src/tipideed/responses.c +++ b/src/tipideed/responses.c @@ -42,8 +42,12 @@ void response_error (tipidee_rql const *rql, char const *docroot, unsigned int s tipidee_defaulttext dt ; char const *file ; size_t salen = g.sa.len ; - if (sarealpath(&g.sa, docroot) == -1 || !stralloc_0(&g.sa)) - strerr_diefu2sys(111, "realpath ", docroot) ; + if (sarealpath(&g.sa, docroot) == -1) + { + if (errno != ENOENT) strerr_diefu2sys(111, "realpath ", docroot) ; + else goto nofile ; + } + if (!stralloc_0(&g.sa)) strerr_diefu1sys(111, "build response") ; if (strncmp(g.sa.s + salen, g.sa.s, g.cwdlen) || g.sa.s[salen + g.cwdlen] != '/') strerr_dief4x(102, "layout error: ", "docroot ", docroot, " points outside of the server's root") ; file = tipidee_conf_get_errorfile(&g.conf, g.sa.s + salen + g.cwdlen + 1, status) ; @@ -89,6 +93,7 @@ void response_error (tipidee_rql const *rql, char const *docroot, unsigned int s } } + nofile: tipidee_response_error_nofile_g(buffer_1, rql, status, dt.reason, dt.text, g.rhdr, g.rhdrn, options & 1 || !g.cont) ; tipidee_log_answer(g.logv, rql, status, 0) ; tain_add_g(&deadline, &g.writetto) ; |