-#!/bin/zsh
+#!/bin/sh
# Copyright 2016 - 2018 Paul Hänsch
#
# You should have received a copy of the GNU Affero General Public License
# along with cgilite. If not, see <http://www.gnu.org/licenses/>.
+[ -n "$include_fileserve" ] && return 0
+include_fileserve="$0"
+
file_type(){
case ${1##*.} in
html|html) printf 'text/html';;
}
FILE(){
- unset range file_size file_date http_date cachedate
+ local file file_size file_date http_date cachedate range
file="$1"
if ! [ -f "$file" ]; then
[ "$REQUEST_METHOD" != HEAD ] \
&& tail -c+$((${range%-*} + 1)) "$file" \
- | head -c "$((${range#*-} - ${range%-*} + 1))"
+ | head -c "$((${range#*-} - ${range%-*} + 1))"
elif [ "${range%-*}" -gt "${range#*-}" ]; then
printf '%s: %s\r\n' \