Skip to content

Commit

Permalink
Revert "Revert "Reducing the assignment of req.cors to a single com…
Browse files Browse the repository at this point in the history
…parison""

This reverts commit eebf474.
  • Loading branch information
avoidwork committed Oct 23, 2018
1 parent 2dcf078 commit 8511fdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ function reduce (uri, map, arg) {
}
}

function schemeless (arg) {
return arg.replace(/^.*:\/\//, "").replace(/\/$/, "");
}

function wrapped (arg) {
return arg[0] === '"' && arg[arg.length - 1] === '"';
}
Expand All @@ -231,7 +227,6 @@ module.exports = {
partial,
pipeable,
reduce,
schemeless,
wrapped,
writeHead
};
4 changes: 2 additions & 2 deletions lib/woodland.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require("path"),
methods = http.METHODS,
Base = require(path.join(__dirname, "base.js")),
regex = require(path.join(__dirname, "regex.js")),
{clone, each, http2Normalize, http2Send, next, normalize, params, parse, partial, pipeable, last, reduce, schemeless, wrapped, writeHead} = require(path.join(__dirname, "utility.js")),
{clone, each, http2Normalize, http2Send, next, normalize, params, parse, partial, pipeable, last, reduce, wrapped, writeHead} = require(path.join(__dirname, "utility.js")),
all = "*",
delimiter = ":";

Expand Down Expand Up @@ -179,7 +179,7 @@ class Woodland extends Base {
req.parsed = parsed;
req.allow = this.allows(req.parsed.pathname);
req.body = "";
req.cors = req.headers.origin !== void 0 && schemeless(req.headers.host || req.headers.referer) !== schemeless(req.headers.origin);
req.cors = req.headers.origin !== void 0;
req.host = req.parsed.hostname;
req.ip = remotes[remotes.length - 1];
req.params = {};
Expand Down

0 comments on commit 8511fdb

Please sign in to comment.