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
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'
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'