Skip to content

Commit f1e74cc

Browse files
authored
fix: use http-proxy-agent (#204)
Signed-off-by: Ruben Romero Montes <[email protected]>
1 parent 33d79db commit f1e74cc

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

package-lock.json

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"fast-toml": "^0.5.4",
5050
"fast-xml-parser": "^4.2.4",
5151
"help": "^3.0.2",
52+
"https-proxy-agent": "^7.0.6",
5253
"node-fetch": "^2.6.7",
5354
"packageurl-js": "^1.0.2",
5455
"yargs": "^17.7.2"

src/analysis.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import fs from "node:fs";
22
import path from "node:path";
33
import {EOL} from "os";
44
import {RegexNotToBeLogged, getCustom} from "./tools.js";
5-
import http from 'node:http';
6-
import https from 'node:https';
5+
import { HttpsProxyAgent } from "https-proxy-agent";
76

87
export default { requestComponent, requestStack, validateToken }
98

@@ -20,10 +19,7 @@ const rhdaOperationTypeHeader = "rhda-operation-type"
2019
function addProxyAgent(options, opts) {
2120
const proxyUrl = getCustom('EXHORT_PROXY_URL', null, opts);
2221
if (proxyUrl) {
23-
const proxyUrlObj = new URL(proxyUrl);
24-
options.agent = proxyUrlObj.protocol === 'https:'
25-
? new https.Agent({ proxy: proxyUrl })
26-
: new http.Agent({ proxy: proxyUrl });
22+
options.agent = new HttpsProxyAgent(proxyUrl);
2723
}
2824
return options;
2925
}

0 commit comments

Comments
 (0)