From: Paul Hänsch Date: Mon, 2 Jul 2018 15:26:31 +0000 (+0200) Subject: State Content-Length in error responses to allow connection reuse X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=a96b0fcd8fb4afad4e169a3929270e2335cf4d0d;p=cgilite State Content-Length in error responses to allow connection reuse --- diff --git a/file.sh b/file.sh index 90e8f9c..9f734c1 100755 --- a/file.sh +++ b/file.sh @@ -41,10 +41,10 @@ FILE(){ file="$1" if ! [ -f "$file" ]; then - printf 'Status: 404 Not Found\r\n\r\n' + printf 'Content-Length: 0\r\nStatus: 404 Not Found\r\n\r\n' exit 0 elif ! [ -r "$file" ]; then - printf 'Status: 403 Forbidden\r\n\r\n' + printf 'Content-Length: 0\r\nStatus: 403 Forbidden\r\n\r\n' exit 0 fi @@ -79,6 +79,7 @@ FILE(){ if [ "$file_date" -lt "$cachedate" ] 2>&-; then printf '%s: %s\r\n' \ Status '304 Not Modified' \ + Content-Length 0 \ Last-Modified "$http_date" printf '\r\n' @@ -110,6 +111,7 @@ FILE(){ elif [ "${range%-*}" -gt "${range#*-}" ]; then printf '%s: %s\r\n' \ Status "216 Range Not Satisfiable" \ + Content-Length 0 \ Content-Range \*/${file_size} printf '\r\n' fi