Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
1 function handleRequest(request, response)
2 {
3 var auth = "";
4 try {
5 auth = request.getHeader("Authorization");
6 } catch(e) {}
8 if (auth == "Basic aHR0cHVzZXI6aHR0cHBhc3M=") {
9 response.setStatusLine("1.1", 200, "OK");
10 response.write("<html><head><title>http auth success</title></head><html>");
11 } else {
12 response.setStatusLine("1.1", 401, "Http authentication required");
13 response.setHeader("WWW-Authenticate", "Basic realm=\"http_realm\"");
14 response.write("<html><head><title>http auth failed</title></head><html>");
15 }
16 }