tor-browser

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

stash.py (502B)


      1 import re
      2 
      3 def main(request, response):
      4    key = request.GET[b'id']
      5    action = request.GET[b'action']
      6    if action == b'put':
      7        # We want the raw input for 'q'
      8        q = re.search(r'q=([^&]+)', request.url_parts.query).groups()[0]
      9        request.server.stash.put(key, q)
     10        return [(b"Content-Type", b"text/html")], u'Put %s' % q
     11    else:
     12        q = request.server.stash.take(key)
     13        if q != None:
     14            return [(b"Content-Type", b"text/html")], q
     15        return [], u""