From ba63783d01e697d7322aa5e1a7a888559a3fe457 Mon Sep 17 00:00:00 2001 From: aescling <11325618-aescling@users.noreply.gitlab.com> Date: Sat, 16 Apr 2022 06:19:29 +0000 Subject: [PATCH] http-header-parse.execline: convert parsed header names to lowercase Update all lookups for what is now called httpd_header_parse_host * Fix accidental whitespace errors --- visible-to-httpd/binaries/http-error-response.execline | 2 +- .../binaries/http-get-extra-headers.execline | 2 +- visible-to-httpd/binaries/http-header-parse.execline | 9 +++++---- .../binaries/http-print-header-files.execline | 2 +- visible-to-httpd/binaries/httpd.execline | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/visible-to-httpd/binaries/http-error-response.execline b/visible-to-httpd/binaries/http-error-response.execline index 0311e21..c388f66 100755 --- a/visible-to-httpd/binaries/http-error-response.execline +++ b/visible-to-httpd/binaries/http-error-response.execline @@ -16,7 +16,7 @@ backtick -n extra_headers { http-get-extra-headers.execline ${1} } multisubstitute { importas -i -u Date Date importas -i -u extra_headers extra_headers - importas -D "?? no hostname ??" hostname http_header_parse_Host + importas -D "?? no hostname ??" hostname http_header_parse_host } backtick -x -n error_response_directory { diff --git a/visible-to-httpd/binaries/http-get-extra-headers.execline b/visible-to-httpd/binaries/http-get-extra-headers.execline index 78c9c26..2cacb1f 100755 --- a/visible-to-httpd/binaries/http-get-extra-headers.execline +++ b/visible-to-httpd/binaries/http-get-extra-headers.execline @@ -17,7 +17,7 @@ # TODO: write a GUI?? with like, `yad(1)` or something??? idk multisubstitute { - importas -D -no_hostname_parsed hostname http_header_parse_Host + importas -D -no_hostname_parsed hostname http_header_parse_host importas -D -no_resource_parsed resource resource } diff --git a/visible-to-httpd/binaries/http-header-parse.execline b/visible-to-httpd/binaries/http-header-parse.execline index 7a0f3f5..73317c5 100755 --- a/visible-to-httpd/binaries/http-header-parse.execline +++ b/visible-to-httpd/binaries/http-header-parse.execline @@ -73,7 +73,7 @@ ifelse { { # the client MUST send a Host header, halt otherwise # - ifelse { s6-test ! -v http_header_parse_Host } + ifelse { s6-test ! -v http_header_parse_host } { http-error-response.execline 400 @@ -95,6 +95,7 @@ ifelse { backtick -x -n header_name { pipeline { printenv current_line } pipeline { sed -n "s/^([^ :]+):.*/\\1/p" } + pipeline { tr A-Z a-z } read } backtick -x -n header_contents { @@ -113,7 +114,7 @@ ifelse { } { importas -i current_line current_line - http-error-response.execline + http-error-response.execline 400 "syntax error" "http-header-parse.execline: bad header line: \""${current_line}\" @@ -130,11 +131,11 @@ multisubstitute { # TODO: [hard, design problem]: short circuit but exec(3p) into the # remaining program # -ifelse { s6-test \${header_name} = Host } +ifelse { s6-test \${header_name} = host } { # we MUST 400 on multiple Host headers # - ifelse { s6-test -v http_header_parse_Host } + ifelse { s6-test -v http_header_parse_host } { http-error-response.execline 400 diff --git a/visible-to-httpd/binaries/http-print-header-files.execline b/visible-to-httpd/binaries/http-print-header-files.execline index f348e01..e0a588e 100755 --- a/visible-to-httpd/binaries/http-print-header-files.execline +++ b/visible-to-httpd/binaries/http-print-header-files.execline @@ -41,7 +41,7 @@ ifelse { s6-test -v http_print_header_directories_${header_name} } # otherwise, print out the header line multisubstitute { - importas -D -no_hostname_parsed hostname http_header_parse_Host + importas -D -no_hostname_parsed hostname http_header_parse_host importas -D -no_resource_parsed requested_resource http_start_line_parse_resource } # wrapper around s6-echo for hostname and resource substitutions in header contents diff --git a/visible-to-httpd/binaries/httpd.execline b/visible-to-httpd/binaries/httpd.execline index 86c7a9f..b38f3dd 100755 --- a/visible-to-httpd/binaries/httpd.execline +++ b/visible-to-httpd/binaries/httpd.execline @@ -88,7 +88,7 @@ if -X -n -t { # http_header_parse_${Header_Name}. # that said, we use only `Host` here. # `/http-header-parse.execline` is implemented in a wonderfully silly way - importas -i hostname http_header_parse_Host + importas -i hostname http_header_parse_host # we don’t need to read anything more from the client heredoc 0 "" -- 2.47.3