summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-11-13 14:58:02 +0000
committerLaurent Bercot <ska@appnovation.com>2023-11-13 14:58:02 +0000
commit4d6765453fedbbe0e6f670cb68ea80a7af06c612 (patch)
treee223914fdf7d496a012d366e41660dab98f58968 /src
parent0cab505405d61922e07096f97159838584d3787d (diff)
downloadtipidee-4d6765453fedbbe0e6f670cb68ea80a7af06c612.tar.xz
bugfix: error with nonexistent Host
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r--src/tipideed/responses.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/tipideed/responses.c b/src/tipideed/responses.c
index ec58622..8f80b18 100644
--- a/src/tipideed/responses.c
+++ b/src/tipideed/responses.c
@@ -40,18 +40,20 @@ void response_error (tipidee_rql const *rql, char const *docroot, unsigned int s
{
tain deadline ;
tipidee_defaulttext dt ;
- char const *file ;
+ char const *file = 0;
size_t salen = g.sa.len ;
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) ;
- g.sa.len = salen ;
+ else
+ {
+ 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) ;
+ g.sa.len = salen ;
+ }
if (!tipidee_util_defaulttext(status, &dt))
{
char fmt[UINT_FMT] ;
@@ -93,7 +95,6 @@ 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) ;