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
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'
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