<%pre> #include #include #include #include "filecache.h" #include "setup.h" using namespace std; using namespace vdrlive; <%args> string file; <%session scope="global"> bool logged_in(false); <%cpp> //if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); reply.setContentType("image/png"); //reply.setContentType("text/plain"); FileCache::ptr_type f = LiveFileCache().get("/tmp/live/" + file); if (f.get() == 0) throw tnt::NotFoundException(request.getUrl()); string ctime = tnt::HttpMessage::htdate(f->ctime()); string browserTime = request.getHeader(tnt::httpheader::ifModifiedSince); if (browserTime == ctime) return HTTP_NOT_MODIFIED; reply.setHeader(tnt::httpheader::lastModified, ctime); reply.out().write(f->data(), f->size());