chore: re-sync proxy-util.js copies

This commit is contained in:
Chris Wilper 2023-10-21 14:32:41 -04:00
parent f8f38802a9
commit bbb904437f
No known key found for this signature in database
GPG Key ID: 565236CE7E3210D1

View File

@ -1,4 +1,5 @@
const parseUrl = require('url').parse;
const { isEmpty } = require('lodash');
const DEFAULT_PORTS = {
ftp: 21,
@ -9,7 +10,7 @@ const DEFAULT_PORTS = {
wss: 443
};
/**
* check for proxy bypass, Copied form 'proxy-from-env'
* check for proxy bypass, copied form 'proxy-from-env'
*/
const shouldUseProxy = (url, proxyBypass) => {
if (proxyBypass === '*') {
@ -39,7 +40,6 @@ const shouldUseProxy = (url, proxyBypass) => {
if (!dontProxyFor) {
return true; // Skip zero-length hosts.
}
const parsedProxy = dontProxyFor.match(/^(.+):(\d+)$/);
let parsedProxyHostname = parsedProxy ? parsedProxy[1] : dontProxyFor;
const parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;