From 7dc49aa5b3856d230a296644caf7e20db66de02f Mon Sep 17 00:00:00 2001 From: single-right-quote <34298117+single-right-quote@users.noreply.github.com> Date: Tue, 24 Aug 2021 04:26:52 +0000 Subject: [PATCH] bugfix: unbreak response when no extra headers --- visible-to-httpd/binaries/http-error-response.execline | 6 ++---- visible-to-httpd/binaries/http-get-extra-headers.execline | 3 +++ visible-to-httpd/binaries/httpd.execline | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/visible-to-httpd/binaries/http-error-response.execline b/visible-to-httpd/binaries/http-error-response.execline index d0e704f..0880566 100755 --- a/visible-to-httpd/binaries/http-error-response.execline +++ b/visible-to-httpd/binaries/http-error-response.execline @@ -56,8 +56,7 @@ if { s6-echo -n -- "HTTP/1.1 "${1}" "${2}"\r Content-Type: "${Content-Type}"\r Content-Length: "${Content-Length}"\r -Date: "${Date}"\r -"${extra_headers}" +Date: "${Date}${extra_headers}" \r " } @@ -81,8 +80,7 @@ Date: "${Date}"\r s6-echo -n -- "HTTP/1.1 "${1}" "${2}"\r Content-Type: application/xhtml+xml; charset=utf-8\r Content-Length: "${Content-Length}"\r -Date: "${Date}"\r -"${extra_headers}" +Date: "${Date}${extra_headers}" \r " } diff --git a/visible-to-httpd/binaries/http-get-extra-headers.execline b/visible-to-httpd/binaries/http-get-extra-headers.execline index 45b56c3..0bee831 100755 --- a/visible-to-httpd/binaries/http-get-extra-headers.execline +++ b/visible-to-httpd/binaries/http-get-extra-headers.execline @@ -63,6 +63,9 @@ backtick -x -n header-directory { # (we output nothing if there is no applicable header directory, which is fine) if -t { s6-test -v header-directory } + # to avoid double \r\n in case we don't output anything + if { s6-echo -n -- "\r\n" } + importas -i -u header-directory header-directory foreground { log.execline "header-directory: "${header-directory} } diff --git a/visible-to-httpd/binaries/httpd.execline b/visible-to-httpd/binaries/httpd.execline index e04807a..85903ea 100755 --- a/visible-to-httpd/binaries/httpd.execline +++ b/visible-to-httpd/binaries/httpd.execline @@ -236,8 +236,7 @@ if -X -n -t { Content-Type: "${Content-Type}"\r Content-Length: "${Content-Length}"\r Last-Modified: "${Last-Modified}"\r -Date: "${Date}"\r -"${extra_headers}" +Date: "${Date}${extra_headers}" \r " } -- 2.47.3