diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /dom/workers/test/redirect_with_query_args.sjs | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/workers/test/redirect_with_query_args.sjs')
-rw-r--r-- | dom/workers/test/redirect_with_query_args.sjs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dom/workers/test/redirect_with_query_args.sjs b/dom/workers/test/redirect_with_query_args.sjs new file mode 100644 index 0000000000..3359367ee0 --- /dev/null +++ b/dom/workers/test/redirect_with_query_args.sjs @@ -0,0 +1,22 @@ +/** + * This file expects a query string that's the upper-cased version of a file to + * be redirected to in the same directory. The redirect will also include + * added "secret data" as a query string. + * + * So if the request is `/path/redirect_with_query_args.sjs?FOO.JS` the redirect + * will be to `/path/foo.js?SECRET_DATA`. + **/ + +function handleRequest(request, response) { + // The secret data to include in the redirect to make the redirect URL + // easily detectable. + const secretData = "SECRET_DATA"; + + let pathBase = request.path.split("/").slice(0, -1).join("/"); + let targetFile = request.queryString.toLowerCase(); + let newUrl = `${pathBase}/${targetFile}?${secretData}`; + + response.setStatusLine(request.httpVersion, 302, "Found"); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Location", newUrl, false); +} |