summaryrefslogtreecommitdiff
path: root/pages/content.ecpp
blob: cc604ba6a16f918a096b8c197b2459b83c0b44c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<%pre>
#include <string>
#include <tnt/httpheader.h>
#include "filecache.h"
#include "setup.h"

using namespace std;
using namespace vdrlive;

</%pre>
<%args>
string file;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%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());
</%cpp>