tor-browser

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

content-encoding-headers.py (488B)


      1 import os.path
      2 
      3 # Return arbitory content-encoding header value.
      4 
      5 def read(file):
      6    path = os.path.join(os.path.dirname(__file__), file)
      7    return open(path, u"rb").read()
      8 
      9 def main(request, response):
     10    response.headers.set(b"Content-Type", b"text/javascript")
     11    response.content = read(u"./dummy.js")
     12 
     13    if b'content_encoding' in request.GET:
     14        content_encoding = request.GET.first(b"content_encoding")
     15        response.headers.set(b"Content-Encoding", content_encoding)