From: cat æscling Date: Mon, 29 Apr 2024 23:01:49 +0000 (-0400) Subject: Fix: Avoid catchall 500 on unsupported hostnames X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=4c68162f72f9cae2ea3e6a5c067e623d635bcc67;p=httpd-execline.git 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 --- 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 {