1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/browser-element/mochitest/file_http_401_response.sjs Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,16 @@ 1.4 +function handleRequest(request, response) 1.5 +{ 1.6 + var auth = ""; 1.7 + try { 1.8 + auth = request.getHeader("Authorization"); 1.9 + } catch(e) {} 1.10 + 1.11 + if (auth == "Basic aHR0cHVzZXI6aHR0cHBhc3M=") { 1.12 + response.setStatusLine("1.1", 200, "OK"); 1.13 + response.write("<html><head><title>http auth success</title></head><html>"); 1.14 + } else { 1.15 + response.setStatusLine("1.1", 401, "Http authentication required"); 1.16 + response.setHeader("WWW-Authenticate", "Basic realm=\"http_realm\""); 1.17 + response.write("<html><head><title>http auth failed</title></head><html>"); 1.18 + } 1.19 +} 1.20 \ No newline at end of file