Skip to content

Commit 3a10d57

Browse files
authored
Merge pull request #5052 from jandubois/revert-https-proxy-agent-bump
Revert: Bump https-proxy-agent from 5.0.1 to 6.1.0
2 parents 6ccc9cc + 975a136 commit 3a10d57

3 files changed

Lines changed: 16 additions & 120 deletions

File tree

package-lock.json

Lines changed: 7 additions & 98 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"fs-extra": "11.1.0",
7171
"http-proxy-agent": "5.0.0",
7272
"http-proxy-middleware": "2.0.6",
73-
"https-proxy-agent": "6.1.0",
73+
"https-proxy-agent": "5.0.1",
7474
"intl-messageformat": "10.2.5",
7575
"jquery": "3.6.3",
7676
"jsonpath": "1.1.1",

pkg/rancher-desktop/main/networking/proxy.ts

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@ import { URL } from 'url';
88
import { Agent, ClientRequest, RequestOptions, AgentCallbackReturn } from 'agent-base';
99
import Electron from 'electron';
1010
import HttpProxyAgent from 'http-proxy-agent';
11-
import { HttpsProxyAgent, HttpsProxyAgentOptions } from 'https-proxy-agent';
11+
import { HttpsProxyAgent } from 'https-proxy-agent';
1212
import { SocksProxyAgent } from 'socks-proxy-agent';
1313

1414
import Logging from '@pkg/utils/logging';
1515

1616
const console = Logging.background;
1717

18-
interface HttpConnectOpts extends net.TcpNetConnectOpts {
19-
secureEndpoint: false;
20-
}
21-
interface HttpsConnectOpts extends tls.ConnectionOptions {
22-
port: number;
23-
secureEndpoint: true;
24-
}
25-
26-
type CustomAgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;
27-
2818
export default class ElectronProxyAgent extends Agent {
2919
protected session: Electron.Session;
3020

@@ -85,25 +75,22 @@ export default class ElectronProxyAgent extends Agent {
8575
}
8676
}
8777

88-
class CustomHttpsProxyAgent<Uri extends string> extends HttpsProxyAgent<Uri> {
89-
constructor(proxy: Uri | URL, opts?: HttpsProxyAgentOptions<Uri>) {
78+
class CustomHttpsProxyAgent extends HttpsProxyAgent {
79+
constructor(proxyURL: string, opts: HttpsAgentOptions) {
9080
// Use object destructing here to ensure we only get wanted properties.
91-
const { hostname, port, protocol } = new URL(proxy.toString());
81+
const { hostname, port, protocol } = new URL(proxyURL);
9282
const mergedOpts = Object.assign({}, opts, {
9383
hostname, port, protocol,
9484
});
9585

96-
super(proxy, mergedOpts);
97-
if (opts) {
98-
this.options = opts;
99-
}
86+
super(mergedOpts);
87+
this.options = opts;
10088
}
10189

102-
async connect(req: http.ClientRequest, opts: CustomAgentConnectOpts): Promise<net.Socket> {
90+
callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket> {
10391
const mergedOptions = Object.assign({}, this.options, opts);
104-
const socket = await super.connect(req, mergedOptions);
10592

106-
return socket;
93+
return super.callback(req, mergedOptions);
10794
}
10895
}
10996

0 commit comments

Comments
 (0)