tor-browser

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

file_downgrade_with_different_path.sjs (711B)


      1 "use strict";
      2 
      3 // An onload postmessage to window opener
      4 const RESPONSE_HTTPS_SCHEME = `
      5   <html>
      6   <body>
      7   <script type="application/javascript">
      8     window.opener.postMessage({result: 'scheme-https-'+window.location}, '*');
      9   </script>
     10   </body>
     11   </html>`;
     12 
     13 const RESPONSE_HTTP_SCHEME = `
     14   <html>
     15   <body>
     16   <script type="application/javascript">
     17     window.opener.postMessage({result: 'scheme-http-'+window.location}'}, '*');
     18   </script>
     19   </body>
     20   </html>`;
     21 
     22 function handleRequest(request, response) {
     23   let response_content =
     24     request.scheme === "https" ? RESPONSE_HTTPS_SCHEME : RESPONSE_HTTP_SCHEME;
     25   response.setStatusLine(request.httpVersion, 200, "OK");
     26   response.write(response_content);
     27 }