X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=file.sh;h=06f28d02f5640abfbfd560641348e8c8e8cd6e22;hp=90e8f9c91d4b339aba048542c3c7ea453955c94d;hb=40c5373a1f5eb710635f340e88c31f8c9dfedfeb;hpb=69474bafc0d39135f537512a6b359c612747d7a8 diff --git a/file.sh b/file.sh index 90e8f9c..06f28d0 100755 --- a/file.sh +++ b/file.sh @@ -17,6 +17,9 @@ # You should have received a copy of the GNU Affero General Public License # along with cgilite. If not, see . +[ -n "$include_fileserve" ] && return 0 +include_fileserve="$0" + file_type(){ case ${1##*.} in html|html) printf 'text/html';; @@ -41,10 +44,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 +82,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 +114,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