X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=static.sh;h=ec860c6efb3a8a10158a1233ad7fdebcd5ce2eda;hp=153cce0e7428f717a64d7fa1ac95103d77808a57;hb=bb8ddd1d7e31ccff9f1ae0d2abb124910a8ad126;hpb=ad0d9ced2d58a16fea9d75f517cd53fc5744cc73 diff --git a/static.sh b/static.sh index 153cce0..ec860c6 100755 --- a/static.sh +++ b/static.sh @@ -19,7 +19,7 @@ unset length date file suffix -file="$_EXEC/static/$STATIC" +file="$1" date="$(stat -c %Y "$file")" # allow overriding magic file recognition @@ -28,9 +28,9 @@ declare -A suffix suffix[css]="text/css" if [ -x "$file" -o \! -r "$file" -o \! -f "$file" ]; then - printf 'HTTP/1.1 403 Forbidden\n\n' + printf 'HTTP/1.1 403 Forbidden\r\n\r\n' elif [ "$date" = "$HTTP_IF_NONE_MATCH" ]; then - printf 'HTTP/1.1 304 Not Modified\n\n' + printf 'HTTP/1.1 304 Not Modified\r\n\r\n' else length="$(stat -c %s "$file")" magic="${suffix[${file##*.}]:-$(file -bi "$file")}"