lib/HttpClient.js
function isProxyForURL(noProxy, address) {
    // wildcard
    if (noProxy === '*') {
        return (null);
    }

    // otherwise, parse the noProxy value to see if it applies to the URL
    if (noProxy !== null) {
        var noProxyItem, hostname, port, noProxyItemParts,
            noProxyHost, noProxyPort, noProxyList;

        // canonicalize the hostname
        /* JSSTYLED */
        hostname = address.hostname.replace(/^\.*/, '.').toLowerCase();
        noProxyList = noProxy.split(',');

        for (var i = 0, len = noProxyList.length; i < len; i++) {
            noProxyItem = noProxyList[i].trim().toLowerCase();

            // no_proxy can be granular at the port level
            if (noProxyItem.indexOf(':') > -1) {
                noProxyItemParts = noProxyItem.split(':', 2);
                /* JSSTYLED */
                noProxyHost = noProxyItemParts[0].replace(/^\.*/, '.');
                noProxyPort = noProxyItemParts[1];
                port = address.port ||
                    (address.protocol === 'https:' ? '443' : '80');

                // match - ports are same and host ends with no_proxy entry.
                if (port === noProxyPort &&
                    hostname.indexOf(noProxyHost) ===
                    hostname.length - noProxyHost.length) {
                    return (null);
                }
            } else {
                /* JSSTYLED */
                noProxyItem = noProxyItem.replace(/^\.*/, '.');
                var isMatchedAt = hostname.indexOf(noProxyItem);

                if (isMatchedAt > -1 &&
                    isMatchedAt === hostname.length - noProxyItem.length) {
                    return (null);
                }
            }
        }
    }
    return (true);
}
function isProxyForURL(noProxy, address) {
    // wildcard
    if (noProxy === '*') {
        return (null);
    }

    // otherwise, parse the noProxy value to see if it applies to the URL
    if (noProxy !== null) {
        var noProxyItem, hostname, port, noProxyItemParts,
            noProxyHost, noProxyPort, noProxyList;

        // canonicalize the hostname
        /* JSSTYLED */
        hostname = address.hostname.replace(/^\.*/, '.').toLowerCase();
        noProxyList = noProxy.split(',');

        for (var i = 0, len = noProxyList.length; i < len; i++) {
            noProxyItem = noProxyList[i].trim().toLowerCase();

            // no_proxy can be granular at the port level
            if (noProxyItem.indexOf(':') > -1) {
                noProxyItemParts = noProxyItem.split(':', 2);
                /* JSSTYLED */
                noProxyHost = noProxyItemParts[0].replace(/^\.*/, '.');
                noProxyPort = noProxyItemParts[1];
                port = address.port ||
                    (address.protocol === 'https:' ? '443' : '80');

                // match - ports are same and host ends with no_proxy entry.
                if (port === noProxyPort &&
                    hostname.indexOf(noProxyHost) ===
                    hostname.length - noProxyHost.length) {
                    return (null);
                }
            } else {
                /* JSSTYLED */
                noProxyItem = noProxyItem.replace(/^\.*/, '.');
                var isMatchedAt = hostname.indexOf(noProxyItem);

                if (isMatchedAt > -1 &&
                    isMatchedAt === hostname.length - noProxyItem.length) {
                    return (null);
                }
            }
        }
    }
    return (true);
}
function isProxyForURL ( noProxy , address ) { // wildcard if ( noProxy === '*' ) { return ( null ) ; } // otherwise, parse the noProxy value to see if it applies to the URL if ( noProxy !== null ) { var noProxyItem , hostname , port , noProxyItemParts , noProxyHost , noProxyPort , noProxyList ; // canonicalize the hostname /* JSSTYLED */ hostname = address . hostname . replace ( / ^\.* / , '.' ) . toLowerCase ( ) ; noProxyList = noProxy . split ( ',' ) ; for ( var i = 0 , len = noProxyList . length ; i < len ; i ++ ) { noProxyItem = noProxyList [ i ] . trim ( ) . toLowerCase ( ) ; // no_proxy can be granular at the port level if ( noProxyItem . indexOf ( ':' ) > - 1 ) { noProxyItemParts = noProxyItem . split ( ':' , 2 ) ; /* JSSTYLED */ noProxyHost = noProxyItemParts [ 0 ] . replace ( / ^\.* / , '.' ) ; noProxyPort = noProxyItemParts [ 1 ] ; port = address . port || ( address . protocol === 'https:' ? '443' : '80' ) ; // match - ports are same and host ends with no_proxy entry. if ( port === noProxyPort && hostname . indexOf ( noProxyHost ) === hostname . length - noProxyHost . length ) { return ( null ) ; } } else { /* JSSTYLED */ noProxyItem = noProxyItem . replace ( / ^\.* / , '.' ) ; var isMatchedAt = hostname . indexOf ( noProxyItem ) ; if ( isMatchedAt > - 1 && isMatchedAt === hostname . length - noProxyItem . length ) { return ( null ) ; } } } } return ( true ) ; }
Check if url is excluded by the no_proxy environment variable
Check if url is excluded by the no_proxy environment variable