MCPcopy Create free account
hub / github.com/nodejs/node / stripURLForReferrer

Function stripURLForReferrer

deps/undici/undici.js:5524–5538  ·  view source on GitHub ↗
(url, originOnly = false)

Source from the content-addressed store, hash-verified

5522 }
5523 __name(determineRequestsReferrer, "determineRequestsReferrer");
5524 function stripURLForReferrer(url, originOnly = false) {
5525 assert(webidl.is.URL(url));
5526 url = new URL(url);
5527 if (urlIsLocal(url)) {
5528 return "no-referrer";
5529 }
5530 url.username = "";
5531 url.password = "";
5532 url.hash = "";
5533 if (originOnly === true) {
5534 url.pathname = "";
5535 url.search = "";
5536 }
5537 return url;
5538 }
5539 __name(stripURLForReferrer, "stripURLForReferrer");
5540 var isPotentialleTrustworthyIPv4 = RegExp.prototype.test.bind(/^127\.(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){2}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/);
5541 var isPotentiallyTrustworthyIPv6 = RegExp.prototype.test.bind(/^(?:(?:0{1,4}:){7}|(?:0{1,4}:){1,6}:|::)0{0,3}1$/);

Callers 1

Calls 2

urlIsLocalFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected