From: paul Date: Tue, 17 Jan 2017 12:43:38 +0000 (+0000) Subject: perform read test on file, not just permission check X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=61b10db5d6923fb8a6df1e4158300fb9d3c613db;p=cgilite perform read test on file, not just permission check svn path=/trunk/; revision=51 --- diff --git a/static.sh b/static.sh index 56d3a25..bf109ed 100755 --- a/static.sh +++ b/static.sh @@ -35,7 +35,7 @@ if printf '%s' "${HTTP_RANGE}" |grep -qE '^bytes=[0-9]+-[0-9]*\r?$'; then _bend="${_range#*-}" fi -if [ -x "$file" -o \! -r "$file" -o \! -f "$file" ]; then +if ! [ -f "$file" ] || [ -x "$file" ] || ! grep -qm1 '' "$file" ; then printf 'Status:403 Forbidden\r\n\r\n' elif [ "$date" = "$cachedate" ]; then printf 'Status:304 Not Modified\r\n'