Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / newline-in-request-uri.html
blobd83498a7b61cd6aaae456c74ea65862d1856a595
1 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=22731">bug 22731</a>:
2 Newline in XMLHttpRequest URL can be used to remove HTTP headers (e.g. Host:).</p>
3 <pre id="lf">LF FAIL: test did not run</pre>
4 <pre id="cr">CR FAIL: test did not run</pre>
5 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 var req = new XMLHttpRequest;
10 req.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/print-headers.cgi\n", false);
11 req.send(null);
12 if (req.responseText.match(/HTTP_HOST: 127.0.0.1:8000/))
13 document.getElementById("lf").innerHTML = "LF SUCCESS";
14 else
15 document.getElementById("lf").innerHTML = "LF FAIL. Headers are:\n" + req.responseText;
17 req.open("GET", "http://127.0.0.1:8000/xmlhttprequest/resources/print-headers.cgi\r", false);
18 req.send(null);
19 if (req.responseText.match(/HTTP_HOST: 127.0.0.1:8000/))
20 document.getElementById("cr").innerHTML = "CR SUCCESS";
21 else
22 document.getElementById("cr").innerHTML = "CR FAIL. Headers are:\n" + req.responseText;
23 </script>