Skip to content

Commit fc9eea0

Browse files
committed
fix: 修复使用 HTTP 代理时 insecure 无效的问题
1 parent a3d41a9 commit fc9eea0

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.20.34",
3+
"version": "2.20.35",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"scripts": {

backend/src/vendor/open-api.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,22 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
472472
connect: {
473473
rejectUnauthorized:
474474
opts.strictSSL === false ||
475-
opts.insecure === true
475+
opts.insecure === true ||
476+
opts.rejectUnauthorized === false
476477
? false
477478
: true,
478479
},
479480
bodyTimeout: opts.timeout,
480481
headersTimeout: opts.timeout,
481482
};
483+
const tlsOptions = {
484+
rejectUnauthorized:
485+
agentOpts.connect.rejectUnauthorized,
486+
};
487+
opts.tls = {
488+
...(opts.tls || {}),
489+
...tlsOptions,
490+
};
482491
try {
483492
const url = new URL(opts.url);
484493
if (url.username || url.password) {
@@ -504,16 +513,23 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
504513
if (/^socks5:\/\//.test(opts.proxy)) {
505514
dispatcher = socksDispatcher(
506515
parseSocks5Uri(opts.proxy),
507-
agentOpts,
516+
{
517+
...agentOpts,
518+
requestTls: tlsOptions,
519+
},
508520
);
509521
} else {
510522
dispatcher = new ProxyAgent({
511523
...agentOpts,
512524
uri: opts.proxy,
525+
requestTls: tlsOptions,
513526
});
514527
}
515528
} else {
516-
dispatcher = new EnvHttpProxyAgent(agentOpts);
529+
dispatcher = new EnvHttpProxyAgent({
530+
...agentOpts,
531+
requestTls: tlsOptions,
532+
});
517533
}
518534
const response = await request(opts.url, {
519535
...opts,

0 commit comments

Comments
 (0)