tor-browser

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

echo-preload-header.py (644B)


      1 import os
      2 from wptserve.utils import isomorphic_encode
      3 
      4 def main(request, response):
      5    response.headers.set(b"Content-Type", request.GET.first(b"type"))
      6    link = request.GET.first(b"link")
      7    response.headers.set(b"Access-Control-Allow-Origin", b"*")
      8    response.headers.set(b"Access-Control-Allow-Credentials", b"true")
      9    if link is not None:
     10        response.headers.set(b"Link", link)
     11 
     12    if b"file" in request.GET:
     13        path = os.path.join(os.path.dirname(isomorphic_encode(__file__)), request.GET.first(b"file"));
     14        response.content = open(path, mode=u'rb').read();
     15    else:
     16        return request.GET.first(b"content")