blob: f53dbeb79d363d12086470aa8c66290d902d1689 (
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
|
var manifest =
"CACHE MANIFEST\n" +
"obsolete.html\n";
function handleRequest(request, response)
{
var match = request.queryString.match(/^state=(.*)$/);
if (match)
{
response.setStatusLine(request.httpVersion, 204, "No content");
response.setHeader("Cache-Control", "no-cache");
setState("offline.obsoletingManifest", match[1]);
}
if (request.queryString == "")
{
switch (getState("offline.obsoletingManifest"))
{
case "": // The default value
response.setStatusLine(request.httpVersion, 404, "Not found");
response.setHeader("Cache-Control", "no-cache");
break;
case "manifestPresent":
response.setStatusLine(request.httpVersion, 200, "Ok");
response.setHeader("Content-Type", "text/cache-manifest");
response.setHeader("Cache-Control", "no-cache");
response.write(manifest);
break;
}
}
}
|