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 56d3a25..bf109ed 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'