tor-browser

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

expect-received.py (937B)


      1 def main(request, response):
      2    """
      3    Check that headers sent to navigate here contain the device-memory client
      4    hint, and report success/failure in a way compatible with
      5    verify_navigation_state() in accept-ch-test.js
      6    """
      7 
      8    if b"sec-ch-device-memory" not in request.headers:
      9      result = u"DEVICE-MEMORY"
     10    elif b"device-memory" not in request.headers:
     11      result = u"DEVICE-MEMORY-DEPRECATED"
     12    elif b"sec-ch-ua" not in request.headers:
     13      result = u"UA"
     14    elif b"sec-ch-ua-mobile" not in request.headers:
     15      result = u"MOBILE"
     16    elif b"sec-ch-ua-platform" not in request.headers:
     17      result = u"PLATFORM"
     18    else:
     19      result = u"PASS"
     20 
     21    content = u'''
     22 <script>
     23  let messagee = window.opener || window.parent;
     24  messagee.postMessage("%s" , "*");
     25 </script>
     26 ''' % (result)
     27    headers = [(b"Content-Type", b"text/html"), (b"Access-Control-Allow-Origin", b"*")]
     28    return 200, headers, content