IngRRD/lib/send_headers
2015-02-01 22:19:48 +01:00

23 lines
580 B
Bash

#!/bin/bash
send_headers() {
local timestamp do_exit header thisdate expiredate
read timestamp < <(stat -c %Y $0 "$rrdfile" lib/* |sort -r)
thisdate=$(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z' -d @$timestamp)
expiredate=$(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z' -d '+1 minute')
if [[ $thisdate == $HTTP_IF_MODIFIED_SINCE ]]
then
echo "Status: 304 Not Modified"
do_exit=1
fi
echo "Last-Modified: $thisdate"
echo "Expires: $expiredate"
echo "Cache-Control: must-revalidate, max-age=60"
while read header
do
echo "$header"
done
echo
(( do_exit )) && exit
}