def serving
if size = F.size?(@path)
body = self
else
body = [F.read(@path)]
size = Utils.bytesize(body.first)
end
[200, {
"Last-Modified" => F.mtime(@path).httpdate,
"Content-Type" => Mime.mime_type(F.extname(@path), 'text/plain'),
"Content-Length" => size.to_s
}, body]
end
Ordinarily, the mtime of a file seems reasonable as a Last-Modified date, but as I'm using Heroku, I do a git push to that server and the mtime gets set to the current push time, not when the image last changed. Also, I'd like to add a Cache-Control header to the response as well and take advantage of the upstream HTTP accelerator that Heroku use, i.e. Varnish.
So, short of monkeypatching the Rack::File module, does anyone know of a way to hook into the serving process and add a header? Or is this something I need to ask the Rack list?
Thanks,