tor-browser

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

do-expect-received.py (659B)


      1 def main(request, response):
      2    """
      3    Check that headers sent to navigate here *do* contain the device-memory client
      4    hint, and report success/failure in a way compatible with
      5    verify_{subresource|iframe}_state() in accept-ch-test.js
      6    """
      7 
      8    if b"device-memory" in request.headers and b"sec-ch-device-memory" in request.headers:
      9      result = u"PASS"
     10    else:
     11      result = u"FAIL"
     12 
     13    content = u'''
     14 <script>
     15  let messagee = window.opener || window.parent;
     16  messagee.postMessage("%s" , "*");
     17 </script>
     18 ''' % (result)
     19    headers = [(b"Content-Type", b"text/html"), (b"Access-Control-Allow-Origin", b"*")]
     20    return 200, headers, content