feat: 兼容传输层 headers 中小写的 host 字段

This commit is contained in:
xream
2023-11-08 09:54:53 +08:00
parent 955c74a77d
commit 69fab11344
2 changed files with 9 additions and 1 deletions

View File

@@ -212,6 +212,14 @@ function lastParse(proxy) {
if (['trojan', 'tuic', 'hysteria', 'hysteria2'].includes(proxy.type)) {
proxy.tls = true;
}
if (proxy.network) {
let transportHost = proxy[`${proxy.network}-opts`]?.headers?.Host;
let transporthost = proxy[`${proxy.network}-opts`]?.headers?.host;
if (transporthost && !transportHost) {
proxy[`${proxy.network}-opts`].headers.Host = transporthost;
delete proxy[`${proxy.network}-opts`].headers.host;
}
}
if (proxy.tls && !proxy.sni) {
if (proxy.network) {
let transportHost = proxy[`${proxy.network}-opts`]?.headers?.Host;