<%pre> #include #include #include #include "filecache.h" #include "setup.h" using namespace std; using namespace vdrlive; <%session scope="global"> bool logged_in(false); <%cpp> //if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); string mime("image/png"); if (request.getArgsCount() > 0) { mime = request.getArg(0); // dsyslog("vdrlive::content found mime arg (%s)", mime.c_str()); } reply.setContentType(mime); // dsyslog("vdrlive::content::mimetype(%s)", mime.c_str()); // FileCache::ptr_type f = LiveFileCache().get("/tmp/live/" + request.getPathInfo()); string path(request.getPathInfo()); FileCache::ptr_type f = LiveFileCache().get(USRDIR "/" + path); if (f.get() == 0) { return DECLINED; } 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());