blob: 54da8be5dc872e3de555eeab725b668a9755dd63 (
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
|
function handleRequest(request, response)
{
var match = request.queryString.match(/^state=(.*)$/);
if (match)
{
response.setStatusLine(request.httpVersion, 200, "No content");
setState("state", match[1]);
response.write("state='" + match[1] + "'");
}
if (request.queryString == "")
{
switch (getState("state"))
{
case "": // The default value
response.setStatusLine(request.httpVersion, 307, "Moved temporarly");
response.setHeader("Location", "http://example.com/non-existing-explicit.html");
response.setHeader("Content-Type", "text/html");
break;
case "on":
response.setStatusLine(request.httpVersion, 200, "OK");
response.setHeader("Content-Type", "text/html");
response.write("<html><body>Explicit page</body></html>");
break;
}
}
}
|