tor-browser

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

file_bad_cert.sjs (961B)


      1 const RESPONSE_SUCCESS = `
      2   <html>
      3     <body>
      4       send message, downgraded
      5     <script type="application/javascript">
      6       let scheme = document.location.protocol;
      7       window.opener.postMessage({result: 'downgraded', scheme: scheme}, '*');
      8     </script>
      9     </body>
     10   </html>`;
     11 
     12 const RESPONSE_UNEXPECTED = `
     13   <html>
     14     <body>
     15       send message, error
     16     <script type="application/javascript">
     17       let scheme = document.location.protocol;
     18       window.opener.postMessage({result: 'Error', scheme: scheme}, '*');
     19     </script>
     20     </body>
     21   </html>`;
     22 
     23 function handleRequest(request, response) {
     24   // avoid confusing cache behaviors
     25   response.setHeader("Cache-Control", "no-cache", false);
     26 
     27   // if the received request is not http send an error
     28   if (request.scheme === "http") {
     29     response.write(RESPONSE_SUCCESS);
     30     return;
     31   }
     32   // we should never get here; just in case, return something unexpected
     33   response.write(RESPONSE_UNEXPECTED);
     34 }