From 4c68162f72f9cae2ea3e6a5c067e623d635bcc67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?cat=20=C3=A6scling?= Date: Mon, 29 Apr 2024 19:01:49 -0400 Subject: [PATCH] Fix: Avoid catchall 500 on unsupported hostnames http-header-parse would exit failure (off the wrong side of an `if`) when a hostname is declared unsuppurrted, triggering the overall `if` wrapper to send a 500. this is concatenated to the already sent message, resulting in a malformed document the solution is to exit success on the unhappy path. * Remove redundant backslashes * Actually fix the bug --- visible-to-httpd/binaries/http-header-parse.execline | 5 ++++- visible-to-httpd/binaries/supported-hostname-test.execline | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/visible-to-httpd/binaries/http-header-parse.execline b/visible-to-httpd/binaries/http-header-parse.execline index 66d6be0..9d1a09c 100755 --- a/visible-to-httpd/binaries/http-header-parse.execline +++ b/visible-to-httpd/binaries/http-header-parse.execline @@ -132,7 +132,10 @@ case -N -- ${current_line_stripped} { } # short circuits on unsupported hostnames - if { ${supported_hostname_test} ${header_contents} } + ifelse -n { ${supported_hostname_test} ${header_contents} } + { + exit 0 + } export http_header_parse_${header_name} ${header_contents} ${0} ${supported_hostname_test} diff --git a/visible-to-httpd/binaries/supported-hostname-test.execline b/visible-to-httpd/binaries/supported-hostname-test.execline index ed767b3..de102c0 100755 --- a/visible-to-httpd/binaries/supported-hostname-test.execline +++ b/visible-to-httpd/binaries/supported-hostname-test.execline @@ -6,8 +6,8 @@ # immediately 404s otherwise ifelse { - eltest ! -d \supported_domains/${1} -o - ! -r \supported_domains/${1} + eltest ! -d supported_domains/${1} -o + ! -r supported_domains/${1} } { if { -- 2.47.3