23 lines
589 B
Bash
23 lines
589 B
Bash
#!/bin/bash
|
|
|
|
send_headers() {
|
|
local timestamp do_exit header thisdate expiredate
|
|
read timestamp < <(stat -c %Y $0 settings "$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
|
|
}
|