From 2bff302c8a8eb6768313df248b06e7f725a4ae87 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Wed, 30 May 2007 20:26:14 +0000 Subject: - new files --- pages/content.ecpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pages/content.ecpp (limited to 'pages') diff --git a/pages/content.ecpp b/pages/content.ecpp new file mode 100644 index 0000000..cc604ba --- /dev/null +++ b/pages/content.ecpp @@ -0,0 +1,34 @@ +<%pre> +#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) + return HTTP_NOT_FOUND; + +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()); + -- cgit v1.2.3