| OLD | NEW |
| (Empty) |
| 1 <body> | |
| 2 <p>Test that Basic credentials are sent preemptively, without waiting for 401 re
sponse code. This is not a MUST level requirement in RFC 2616, but it's good to
implement.</p> | |
| 3 <p>No authentication dialogs should appear, and the below line should say "PASS"
.</p> | |
| 4 <div id=result>Test didn't run.</div> | |
| 5 <script> | |
| 6 if (window.testRunner) { | |
| 7 testRunner.dumpAsText(); | |
| 8 testRunner.waitUntilDone(); | |
| 9 } | |
| 10 | |
| 11 function step1() | |
| 12 { | |
| 13 // Remember credentials for a protection space. | |
| 14 var req = new XMLHttpRequest; | |
| 15 req.open("GET", "resources/basic-auth-default/dir1/basic-auth.php", true, "t
est", "test"); | |
| 16 req.onload = step2; | |
| 17 document.getElementById("result").innerHTML = "Testing, step 1..."; | |
| 18 req.send(); | |
| 19 } | |
| 20 | |
| 21 function step2() | |
| 22 { | |
| 23 // Same protection space, another directory. The first request will go out w
ithout credentials | |
| 24 // (untested), and then we'll remember that this directory in the same prote
ction space. | |
| 25 var req = new XMLHttpRequest; | |
| 26 req.open("GET", "resources/basic-auth-default/dir2/basic-auth.php", true); | |
| 27 req.onload = step3; | |
| 28 document.getElementById("result").innerHTML = "Testing, step 2..."; | |
| 29 req.send(); | |
| 30 } | |
| 31 | |
| 32 function step3() | |
| 33 { | |
| 34 // Same directory, so the very first request should carry basic credentials.
If there are none, | |
| 35 // the script will return code 500. | |
| 36 var req = new XMLHttpRequest; | |
| 37 req.open("GET", "resources/basic-auth-default/dir2/catch.php", true); | |
| 38 req.onload = function() { | |
| 39 document.getElementById("result").innerHTML = req.status == 200 ? "PASS"
: "FAIL"; | |
| 40 if (window.testRunner) | |
| 41 testRunner.notifyDone(); | |
| 42 } | |
| 43 document.getElementById("result").innerHTML = "Testing, step 3..."; | |
| 44 req.send(); | |
| 45 } | |
| 46 | |
| 47 step1(); | |
| 48 </script> | |
| 49 </body> | |
| OLD | NEW |