#!/bin/sh

file="$PATH_TRANSLATED"

if [ ! -f "$file" ]
then
	printf 'Status: 404 Not Found\r\n'
	printf 'Content-Type: text/plain\r\n\r\n'

	echo "$file: file not found"
	exit 0
fi

mtime=`stat -c '%Y' "$file"`
date=`date --rfc-2822 -d @$mtime`

printf 'Content-Type: application/octet-stream\r\n'
printf 'Last-Modified: %s\r\n\r\n' "$date"

cat "$file"
