From 703e03aba33f234712206769f57717ba7d92d23d Mon Sep 17 00:00:00 2001 From: LinuxWizard42 Date: Wed, 12 Oct 2022 22:54:37 +0300 Subject: Added export_allowed file to make repository visible in cgit --- .../dist/utilities/isUrlMatchingNoProxy.js.flow | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow (limited to 'node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow') diff --git a/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow b/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow new file mode 100644 index 0000000..f2de584 --- /dev/null +++ b/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow @@ -0,0 +1,37 @@ +// @flow + +import { + parse as parseUrl, +} from 'url'; +import matcher from 'matcher'; +import { + UnexpectedStateError, +} from '../errors'; + +export default (subjectUrl: string, noProxy: string) => { + const subjectUrlTokens = parseUrl(subjectUrl); + + const rules = noProxy.split(/[\s,]+/); + + for (const rule of rules) { + const ruleMatch = rule + .replace(/^(?\.)/, '*') + .match(/^(?.+?)(?::(?\d+))?$/); + + if (!ruleMatch || !ruleMatch.groups) { + throw new UnexpectedStateError('Invalid NO_PROXY pattern.'); + } + + if (!ruleMatch.groups.hostname) { + throw new UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.'); + } + + const hostnameIsMatch = matcher.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname); + + if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) { + return true; + } + } + + return false; +}; -- cgit v1.2.3-86-g962b