summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/file_http_407_response.sjs
blob: da2f27620d2eb13935ca5c0b3f9c205b36e35b77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function handleRequest(request, response)
{
  var auth = "";
  try {
    auth = request.getHeader("Proxy-Authorization");
  } catch(e) {}

  if (auth == "Basic cHJveHl1c2VyOnByb3h5cGFzcw==") {
    response.setStatusLine("1.1", 200, "OK");
    response.write("<html><head><title>http auth success</title></head><html>");
  } else {
    response.setStatusLine("1.1", 407, "Proxy Authentication Required");
    response.setHeader("Proxy-Authenticate", "Basic realm=\"http_realm\"");
    response.write("<html><head><title>http auth failed</title></head><html>");
  }
}