blob: 8137f9e58a667f90922c1be60e94fa582238e04d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// Simple script redirects takes the query part of te request and splits it on
// the | character. Anything before is included as the X-Target-Digest header
// the latter part is used as the url to redirect to
function handleRequest(request, response) {
let pos = request.queryString.indexOf("|");
let header = request.queryString.substring(0, pos);
let url = request.queryString.substring(pos + 1);
response.setStatusLine(request.httpVersion, 302, "Found");
response.setHeader("X-Target-Digest", header);
response.setHeader("Location", url);
response.write("See " + url);
}
|