Skip to content

Commit

Permalink
Upgrade https-proxy-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Oct 18, 2023
1 parent 89e6c41 commit c6c576d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion node-src/io/HTTPClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface HTTPClientOptions {

export interface HTTPClientFetchOptions {
noLogErrorBody?: boolean;
proxy?: HttpsProxyAgentOptions;
proxy?: HttpsProxyAgentOptions<any>;
retries?: number;
}

Expand Down
15 changes: 3 additions & 12 deletions node-src/io/getProxyAgent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import createHttpsProxyAgent, { HttpsProxyAgentOptions } from 'https-proxy-agent';
import { HttpsProxyAgent, HttpsProxyAgentOptions } from 'https-proxy-agent';
import noProxy from 'no-proxy';
import { URL } from 'url';
import { Context } from '../types';
Expand All @@ -8,24 +8,15 @@ const agents = {};
const getProxyAgent = (
{ env, log }: Pick<Context, 'env' | 'log'>,
url: string,
options: HttpsProxyAgentOptions
options: HttpsProxyAgentOptions<any>
) => {
const proxy = env.HTTPS_PROXY || env.HTTP_PROXY;
if (!proxy || noProxy(url)) return undefined;

log.debug({ url, proxy, options }, 'Using proxy agent');
const requestHost = new URL(url).host;
if (!agents[requestHost]) {
const { hostname, port, protocol, username, password, pathname } = new URL(proxy);
const auth = username && password ? `${username}:${password}` : undefined;
agents[requestHost] = createHttpsProxyAgent({
auth,
hostname,
port,
protocol,
pathname,
...options,
});
agents[requestHost] = new HttpsProxyAgent(proxy, options);
}
return agents[requestHost];
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"execa": "^7.2.0",
"fake-tag": "^2.0.0",
"fs-extra": "^10.0.0",
"https-proxy-agent": "^5.0.0",
"https-proxy-agent": "^7.0.2",
"husky": "^7.0.0",
"jsonfile": "^6.0.1",
"junit-report-builder": "2.1.0",
Expand Down
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4418,6 +4418,13 @@ agent-base@6:
dependencies:
debug "4"

agent-base@^7.0.2:
version "7.1.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.0.tgz#536802b76bc0b34aa50195eb2442276d613e3434"
integrity sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==
dependencies:
debug "^4.3.4"

aggregate-error@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a"
Expand Down Expand Up @@ -9129,6 +9136,14 @@ https-proxy-agent@^5.0.0:
agent-base "6"
debug "4"

https-proxy-agent@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz#e2645b846b90e96c6e6f347fb5b2e41f1590b09b"
integrity sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==
dependencies:
agent-base "^7.0.2"
debug "4"

human-signals@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
Expand Down

0 comments on commit c6c576d

Please sign in to comment.