blob: a36a69cce6774a2b5f8caaae85a236e95ef3ec9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
def main(request, response):
name = request.GET.first(b"name")
value = request.GET.first(b"value")
source_origin = request.headers.get(b"origin")
if source_origin is None:
# Same origin GET won't include origin header
source_origin = "%s://%s" % (request.url_parts.scheme,
request.url_parts.netloc)
if request.url_parts.port:
source_origin += ":%s" % request.url_parts.port
response_headers = [(b"Set-Cookie", name + b"=" + value),
(b"Access-Control-Allow-Origin", source_origin),
(b"Access-Control-Allow-Credentials", b"true")]
return (200, response_headers, u"")
|