Fix ws transport host header import again

This commit is contained in:
parhelia512 2025-12-13 03:56:13 +08:00 committed by GitHub
parent e53f59c987
commit 934bd00eb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,9 +98,20 @@ namespace Configs {
if (object.contains("headers") && object["headers"].isObject()) {
auto headerObj = object["headers"].toObject();
if (type == "ws") {
if (headerObj.contains("Host")) host = headerObj["Host"].toString();
if (headerObj.contains("Host")) {
if (headerObj["Host"].isString()) {
host = headerObj["Host"].toString();
} else if (headerObj["Host"].isArray()) {
for (const auto& v : headerObj["Host"].toArray()) {
if (v.isString()) {
host = v.toString();
break;
}
}
}
headerObj.remove("Host");
}
}
headers = jsonObjectToQStringList(headerObj);
}
if (object.contains("idle_timeout")) idle_timeout = object["idle_timeout"].toString();