From: paul Date: Mon, 28 Nov 2016 18:53:33 +0000 (+0000) Subject: support serving of symlinked files X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=d4e1d709a6710c2a4941d34cce58d2cfc5dea782;p=cgilite support serving of symlinked files svn path=/trunk/; revision=48 --- diff --git a/static.sh b/static.sh index 6e9ceb7..56d3a25 100755 --- a/static.sh +++ b/static.sh @@ -20,7 +20,7 @@ unset length date file suffix file="$1" -date="$(stat -c %Y "$file")" +date="$(stat -Lc %Y "$file")" # allow overriding magic file recognition # don't use this if `file` returns type correctly @@ -41,7 +41,7 @@ elif [ "$date" = "$cachedate" ]; then printf 'Status:304 Not Modified\r\n' printf 'Last-Modified: %s\r\n\r\n' "$(date -Rd "@$date")" elif [ "$_bstart" -gt 0 ] ; then - length="$(stat -c %s "$file")" + length="$(stat -Lc %s "$file")" magic="${suffix[${file##*.}]:-$(file -bi "$file")}" printf 'Status:206 Partial Content\r\n' @@ -53,7 +53,7 @@ elif [ "$_bstart" -gt 0 ] ; then tail -c+"$(($_bstart + 1))" "$file" else - length="$(stat -c %s "$file")" + length="$(stat -Lc %s "$file")" magic="${suffix[${file##*.}]:-$(file -bi "$file")}" printf 'Accept-Ranges: bytes\r\n'