]> git.plutz.net Git - cgilite/commitdiff
perform read test on file, not just permission check
authorpaul <paul@plutz.net>
Tue, 17 Jan 2017 12:43:38 +0000 (12:43 +0000)
committerpaul <paul@plutz.net>
Tue, 17 Jan 2017 12:43:38 +0000 (12:43 +0000)
svn path=/trunk/; revision=51

static.sh

index 56d3a25e1a93dc1d2173d9f168ced79bf51ac750..bf109ed26959e708d6d675ba57d38e829da517da 100755 (executable)
--- 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'