| OLD | NEW |
| 1 import base64 | 1 import base64 |
| 2 import json | 2 import json |
| 3 | 3 |
| 4 def main(request, response): | 4 def main(request, response): |
| 5 headers = [] | 5 headers = [] |
| 6 headers.append(('X-ServiceWorker-ServerHeader', 'SetInTheServer')) | 6 headers.append(('X-ServiceWorker-ServerHeader', 'SetInTheServer')) |
| 7 | 7 |
| 8 if "ACAOrigin" in request.GET: | 8 if "ACAOrigin" in request.GET: |
| 9 for item in request.GET["ACAOrigin"].split(","): | 9 for item in request.GET["ACAOrigin"].split(","): |
| 10 headers.append(("Access-Control-Allow-Origin", item)) | 10 headers.append(("Access-Control-Allow-Origin", item)) |
| 11 | 11 |
| 12 for suffix in ["Headers", "Methods", "Credentials"]: | 12 for suffix in ["Headers", "Methods", "Credentials"]: |
| 13 query = "ACA%s" % suffix | 13 query = "ACA%s" % suffix |
| 14 header = "Access-Control-Allow-%s" % suffix | 14 header = "Access-Control-Allow-%s" % suffix |
| 15 if query in request.GET: | 15 if query in request.GET: |
| 16 headers.append((header, request.GET[query])) | 16 headers.append((header, request.GET[query])) |
| 17 | 17 |
| 18 if "ACEHeaders" in request.GET: | 18 if "ACEHeaders" in request.GET: |
| 19 headers.append(("Access-Control-Expose-Headers", request.GET[query])) | 19 headers.append(("Access-Control-Expose-Headers", request.GET["ACEHeaders
"])) |
| 20 | 20 |
| 21 if ("Auth" in request.GET and not request.auth.username) or "AuthFail" in re
quest.GET: | 21 if ("Auth" in request.GET and not request.auth.username) or "AuthFail" in re
quest.GET: |
| 22 status = 401 | 22 status = 401 |
| 23 headers.append(('WWW-Authenticate', 'Basic realm="Restricted"')) | 23 headers.append(('WWW-Authenticate', 'Basic realm="Restricted"')) |
| 24 body = 'Authentication canceled' | 24 body = 'Authentication canceled' |
| 25 return status, headers, body | 25 return status, headers, body |
| 26 | 26 |
| 27 if "PNGIMAGE" in request.GET: | 27 if "PNGIMAGE" in request.GET: |
| 28 headers.append(("Content-Type", "image/png")) | 28 headers.append(("Content-Type", "image/png")) |
| 29 body = base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9h
AAAAAXNSR0IArs4c6QAAAARnQU1B" | 29 body = base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9h
AAAAAXNSR0IArs4c6QAAAARnQU1B" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 60 "headers": headers_data, | 60 "headers": headers_data, |
| 61 "body": request.body, | 61 "body": request.body, |
| 62 "files": files, | 62 "files": files, |
| 63 "GET": get_data, | 63 "GET": get_data, |
| 64 "POST": post_data, | 64 "POST": post_data, |
| 65 "username": username, | 65 "username": username, |
| 66 "password": password, | 66 "password": password, |
| 67 "cookie": cookie} | 67 "cookie": cookie} |
| 68 | 68 |
| 69 return headers, "report( %s )" % json.dumps(data) | 69 return headers, "report( %s )" % json.dumps(data) |
| OLD | NEW |