test_bug599295.html (1479B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=599295 5 --> 6 <head> 7 <title>Test for Bug 599295</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599295">Mozilla Bug 599295</a> 14 <pre id="test"> 15 <script type="application/javascript"> 16 17 /** Test for Bug 599295 */ 18 19 /* Do not allow a response to a CONNECT method, used to establish an 20 SSL tunnel over an HTTP proxy, to contain a redirect */ 21 22 function runTest() { 23 /* Previously, necko would allow a 302 as part of a CONNECT response 24 if the LOAD_DOCUMENT_URI flag was set and the original document 25 URI had not yet been changed. */ 26 27 SpecialPowers.loadChannelAndReturnStatus("https://redirproxy.example.com/test", 28 true) 29 .then(function({status, httpStatus}) { 30 /* testing here that the redirect was not followed. If it was followed 31 we would see a http status of 200 and status of NS_OK */ 32 33 is(httpStatus, 302, "http status 302"); 34 is(status, SpecialPowers.Cr.NS_ERROR_CONNECTION_REFUSED, 35 "raised refused"); 36 SimpleTest.finish(); 37 }); 38 } 39 40 SimpleTest.waitForExplicitFinish(); 41 SimpleTest.waitForFocus(runTest); 42 43 </script> 44 </pre> 45 </body> 46 </html>