X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=static.sh;h=44c6556ed147a91e99218e2600bda85f09972c4b;hp=e8de7d16dc727bdaf18170f59cf261862173b6dd;hb=79aaaa252341d41f0afb379365794e184da5edfd;hpb=0678b538a6d0f56a629a8e4dd9ef6e7665b14208 diff --git a/static.sh b/static.sh index e8de7d1..44c6556 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 @@ -30,7 +30,8 @@ suffix[css]="text/css" if [ -x "$file" -o \! -r "$file" -o \! -f "$file" ]; then printf 'HTTP/1.1 403 Forbidden\r\n\r\n' elif [ "$date" = "$HTTP_IF_NONE_MATCH" ]; then - printf 'HTTP/1.1 304 Not Modified\r\n\r\n' + printf 'HTTP/1.1 304 Not Modified\r\n' + printf 'Etag: %s\r\n\r\n' "$date" else length="$(stat -c %s "$file")" magic="${suffix[${file##*.}]:-$(file -bi "$file")}"