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 {
# 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
}
{
# 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
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 {
}
{
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}\"
# 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
# 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
# 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 ""