send-authentication-existing-session-manual.htm (1554B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password from interactive session</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/utils.js"></script> 8 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> 9 </head> 10 <body> 11 <p>Please follow these steps to complete the test:</p> 12 <script>var user = token();</script> 13 <ol> 14 <li>Load <a href="resources/auth3/auth.py">page</a> and authenticate with username "<script>document.write(user)</script>" and password "pass"</li> 15 <li>Go back</li> 16 <li>Click <button onclick="location.href = location.href + '?dotest&user=' + user">complete test</button></li> 17 </ol> 18 <div id="log"></div> 19 <script> 20 if (location.search.indexOf('?dotest') != -1) { 21 test(function() { 22 var user = location.search.slice(location.search.indexOf('&user=') + 6), 23 client = new XMLHttpRequest(), 24 urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/') 25 client.open("GET", location.protocol+'//'+urlstart + "resources/auth3/auth.py", false) 26 client.send(null) 27 assert_equals(client.responseText, user + "\n" + 'pass') 28 assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT') 29 }, document.title) 30 } 31 </script> 32 </body> 33 </html>