blob: a80efd6e8436408db15d8019beef3abc0dfd0ab9 [file] [log] [blame]
Hallvord Reiar M. Steen210320d2013-05-23 10:51:231<!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>
James Graham234a6722013-09-17 17:54:387 <script src="/common/utils.js"></script>
Ms2ger91fef142014-11-01 09:24:378 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
Hallvord Reiar M. Steen210320d2013-05-23 10:51:239 </head>
10 <body>
11 <p>Please follow these steps to complete the test:</p>
James Graham234a6722013-09-17 17:54:3812 <script>var user = token();</script>
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2313 <ol>
James Graham234a6722013-09-17 17:54:3814 <li>Load <a href="resources/auth3/auth.py">page</a> and authenticate with username "<script>document.write(user)</script>" and password "pass"</li>
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2315 <li>Go back</li>
James Graham234a6722013-09-17 17:54:3816 <li>Click <button onclick="location.href = location.href + '?dotest&user=' + user">complete test</button></li>
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2317 </ol>
18 <div id="log"></div>
19 <script>
James Graham234a6722013-09-17 17:54:3820 if (location.search.indexOf('?dotest') != -1) {
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2321 test(function() {
James Graham234a6722013-09-17 17:54:3822 var user = location.search.slice(location.search.indexOf('&user=') + 6),
23 client = new XMLHttpRequest(),
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2324 urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/')
James Graham234a6722013-09-17 17:54:3825 client.open("GET", location.protocol+'//'+urlstart + "resources/auth3/auth.py", false)
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2326 client.send(null)
James Graham234a6722013-09-17 17:54:3827 assert_equals(client.responseText, user + "\n" + 'pass')
Hallvord Reiar M. Steen210320d2013-05-23 10:51:2328 assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT')
29 }, document.title)
30 }
31 </script>
32 </body>
33</html>