blob: bd559d5d1e252e33863fe2ae369370556cfd4477 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from wptserve.utils import isomorphic_decode
def main(request, response):
if b'Status' in request.GET:
status = int(request.GET[b"Status"])
else:
status = 302
headers = []
url = isomorphic_decode(request.GET[b'Redirect'])
headers.append((b"Location", url))
if b"ACAOrigin" in request.GET:
for item in request.GET[b"ACAOrigin"].split(b","):
headers.append((b"Access-Control-Allow-Origin", item))
for suffix in [b"Headers", b"Methods", b"Credentials"]:
query = b"ACA%s" % suffix
header = b"Access-Control-Allow-%s" % suffix
if query in request.GET:
headers.append((header, request.GET[query]))
if b"ACEHeaders" in request.GET:
headers.append((b"Access-Control-Expose-Headers", request.GET[b"ACEHeaders"]))
return status, headers, b""
|