function getHttpsProxyAgent()

in src/extension/update.ts [17:43]


function getHttpsProxyAgent() {
    // See if we have an HTTP proxy set up in VSCode's proxy settings or
    // if it has been set up in the process environment.
    // NOTE: The upper and lower case versions are best attempt effort as enumerating through
    // all the environment key\value pairs to perform case insensitive compares for "http(s)_proxy"
    // would be a bit too much.
    const proxy = workspace.getConfiguration().get<string | undefined>('http.proxy', undefined) ||
        process.env.HTTPS_PROXY ||
        process.env.https_proxy ||
        process.env.HTTP_PROXY ||
        process.env.http_proxy;
    if (!proxy) { // If no proxy is defined, we're done
        return undefined;
    }

    const { protocol, port, host, auth } = urlParse(proxy); // TODO: Consider migrating to to URL?
    if (!protocol || (protocol !== 'https:' && protocol !== 'http:')) {
        return undefined;
    }

    return new HttpsProxyAgent({
        port: port && +port,
        host: host,
        auth: auth,
        secureProxy: workspace.getConfiguration().get('http.proxyStrictSSL', true)
    });
}