fix: 修复使用 HTTP 代理时 insecure 无效的问题

This commit is contained in:
xream committed 2025-11-05 21:03:23 +08:00
1 parent a3d41a9c8e
commit fc9eea0dd2
2 files changed
+20 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.20.34",
"version": "2.20.35",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
+19 -3
View File
@@ -472,13 +472,22 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
connect: {
rejectUnauthorized:
opts.strictSSL === false ||
opts.insecure === true
opts.insecure === true ||
opts.rejectUnauthorized === false
? false
: true,
},
bodyTimeout: opts.timeout,
headersTimeout: opts.timeout,
};
const tlsOptions = {
rejectUnauthorized:
agentOpts.connect.rejectUnauthorized,
};
opts.tls = {
...(opts.tls || {}),
...tlsOptions,
};
try {
const url = new URL(opts.url);
if (url.username || url.password) {
@@ -504,16 +513,23 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
if (/^socks5:\/\//.test(opts.proxy)) {
dispatcher = socksDispatcher(
parseSocks5Uri(opts.proxy),
agentOpts,
{
...agentOpts,
requestTls: tlsOptions,
},
);
} else {
dispatcher = new ProxyAgent({
...agentOpts,
uri: opts.proxy,
requestTls: tlsOptions,
});
}
} else {
dispatcher = new EnvHttpProxyAgent(agentOpts);
dispatcher = new EnvHttpProxyAgent({
...agentOpts,
requestTls: tlsOptions,
});
}
const response = await request(opts.url, {
...opts,