B2G/gecko/toolkit/mozapps/extensions/test/xpinstall/authRedirect.sjs
// authenticates with username "testuser" password "testpass"
authenticates with username "testuser" password "testpass"
authenticates with username " testuser " password " testpass "
function handleRequest(request, response) {
  if (request.hasHeader("Authorization")) {
    if (request.getHeader("Authorization") == "Basic dGVzdHVzZXI6dGVzdHBhc3M=") {
      response.setStatusLine(request.httpVersion, 302, "Found");
      response.setHeader("Location", request.queryString);
      response.write("See " + request.queryString);
    }
    else {
      response.setStatusLine(request.httpVersion, 403, "Forbidden");
      response.write("Invalid credentials");
    }
  }
  else {
    response.setStatusLine(request.httpVersion, 401, "Authentication required");
    response.setHeader("WWW-Authenticate", "basic realm=\"XPInstall\"", false);
    response.write("Unauthenticated request");
  }
}
function handleRequest ( request , response ) { if ( request . hasHeader ( "Authorization" ) ) { if ( request . getHeader ( "Authorization" ) == "Basic dGVzdHVzZXI6dGVzdHBhc3M=" ) { response . setStatusLine ( request . httpVersion , 302 , "Found" ) ; response . setHeader ( "Location" , request . queryString ) ; response . write ( "See " + request . queryString ) ; } else { response . setStatusLine ( request . httpVersion , 403 , "Forbidden" ) ; response . write ( "Invalid credentials" ) ; } } else { response . setStatusLine ( request . httpVersion , 401 , "Authentication required" ) ; response . setHeader ( "WWW-Authenticate" , "basic realm=\"XPInstall\"" , false ) ; response . write ( "Unauthenticated request" ) ; } }
authenticates with username "testuser" password "testpass"
authenticates with username " testuser " password " testpass "