forked from olcxjas-softworks/LarpixClient
fix gitignore again
This commit is contained in:
parent
ce5a1e330b
commit
5da5c2afe2
3329 changed files with 364540 additions and 3 deletions
37
electron/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow
generated
vendored
Normal file
37
electron/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow
generated
vendored
Normal file
|
|
@ -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(/^(?<leadingDot>\.)/, '*')
|
||||
.match(/^(?<hostname>.+?)(?::(?<port>\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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue