tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

file_redirect.sjs (923B)


      1 const SITE_META_REDIRECT = `
      2 <html>
      3   <head>
      4     <meta http-equiv="refresh" content="0; url='https://example.com/tests/dom/security/test/sec-fetch/file_redirect.sjs?redirect302'">
      5   </head>
      6   <body>
      7     META REDIRECT
      8   </body>
      9 </html>
     10 `;
     11 
     12 const REDIRECT_302 =
     13   "https://example.com/tests/dom/security/test/sec-fetch/file_redirect.sjs?pageC";
     14 
     15 function handleRequest(req, res) {
     16   // avoid confusing cache behaviour
     17   res.setHeader("Cache-Control", "no-cache", false);
     18   res.setHeader("Content-Type", "text/html", false);
     19 
     20   switch (req.queryString) {
     21     case "meta":
     22       res.write(SITE_META_REDIRECT);
     23       return;
     24     case "redirect302":
     25       res.setStatusLine("1.1", 302, "Found");
     26       res.setHeader("Location", REDIRECT_302, false);
     27       return;
     28     case "pageC":
     29       res.write("<html><body>PAGE C</body></html>");
     30       return;
     31   }
     32 
     33   res.write(`<html><body>THIS SHOULD NEVER BE DISPLAYED</body></html>`);
     34 }