All responses with Location header are now 3xx redirects.
This commit is contained in:
parent
93889026c3
commit
0901e44f79
1 changed files with 3 additions and 1 deletions
4
index.js
4
index.js
|
@ -126,6 +126,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
|||
if (hso[1] !== undefined) msg = heada.split(" ").splice(1).join(" ");
|
||||
}
|
||||
}
|
||||
var hasLocation = false;
|
||||
for (var i = 0; i < bheaders.length; i++) {
|
||||
var headerp = bheaders[i].split(": ");
|
||||
var headern = headerp.shift();
|
||||
|
@ -137,11 +138,12 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
|||
if (!bheaderso["Set-Cookie"]) bheaderso["Set-Cookie"] = [];
|
||||
bheaderso["Set-Cookie"].push(headerv);
|
||||
} else {
|
||||
if (headern.toLowerCase() == "location") hasLocation = true;
|
||||
bheaderso[headern] = headerv;
|
||||
}
|
||||
}
|
||||
|
||||
if (code == 200 && (bheaderso["Location"] || bheaderso["location"])) {
|
||||
if (code < 300 && code > 399 && hasLocation) {
|
||||
code = 302;
|
||||
msg = "Found";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue