mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-28 07:24:12 +00:00
fix: 修复使用 HTTP 代理时 insecure 无效的问题
This commit is contained in:
2 files changed
+20
-4
No files matched your search
@@ -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": {
|
||||
|
||||
Vendored
+19
-3
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user