Backed out 2 changesets (bug 1881078, bug 1879806) for causing dt failures @ devtools...
[gecko.git] / netwerk / test / browser / cookie_filtering_resource.sjs
blob979d56dc9c4a1ba3d3a22b33c3537713cd2a4e86
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict";
7 function handleRequest(request, response) {
8   response.setStatusLine(request.httpVersion, 200, "OK");
9   response.setHeader("Cache-Control", "no-cache", false);
10   response.setHeader("Content-Type", "text/html", false);
12   // configure set-cookie domain
13   let domain = "";
14   if (request.hasHeader("return-cookie-domain")) {
15     domain = "; Domain=" + request.getHeader("return-cookie-domain");
16   }
18   // configure set-cookie sameSite
19   let authStr = "; Secure";
20   if (request.hasHeader("return-insecure-cookie")) {
21     authStr = "";
22   }
24   // use headers to decide if we have them
25   if (request.hasHeader("return-set-cookie")) {
26     response.setHeader(
27       "Set-Cookie",
28       request.getHeader("return-set-cookie") + authStr + domain,
29       false
30     );
31   }
33   let body = "<!DOCTYPE html> <html> <body> true </body> </html>";
34   response.write(body);