tor-browser

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

header-user-agent.py (648B)


      1 def main(request, response):
      2    response.headers.set(b"Access-Control-Allow-Origin", b"*")
      3    response.headers.set(b"Access-Control-Max-Age", 0)
      4    response.headers.set(b'Access-Control-Allow-Headers', b"x-test")
      5 
      6    if request.method == u"OPTIONS":
      7        if not request.headers.get(b"User-Agent"):
      8            response.content = b"FAIL: User-Agent header missing in preflight request."
      9            response.status = 400
     10    else:
     11        if request.headers.get(b"User-Agent"):
     12            response.content = b"PASS"
     13        else:
     14            response.content = b"FAIL: User-Agent header missing in request"
     15            response.status = 400