blob: 5649b88f2f010dc5dbf9e72864e84c4a419c0063 (
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
28
29
30
31
32
|
function handleRequest(aRequest, aResponse) {
if (aRequest.hasHeader("Origin")) {
let origin = aRequest.getHeader("Origin");
aResponse.setHeader("Access-Control-Allow-Origin", origin);
aResponse.setHeader("Access-Control-Allow-Credentials", "true");
}
var params = new URLSearchParams(aRequest.queryString);
if (params.has("redirect")) {
aResponse.setHeader("Location", params.get("redirect"));
aResponse.setStatusLine(aRequest.httpVersion, 302);
} else {
aResponse.setStatusLine(aRequest.httpVersion, 200);
}
if (params.has("nocookie")) {
return;
}
if (params.has("nosecure")) {
aResponse.setHeader("Set-Cookie", "c=3; Partitioned;", true);
return;
}
aResponse.setHeader("Set-Cookie", "a=1; SameSite=None; Secure", true);
aResponse.setHeader(
"Set-Cookie",
"b=2; Partitioned; SameSite=None; Secure",
true
);
}
|