dom/browser-element/mochitest/file_http_401_response.sjs

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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 }

mercurial