mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
Fix ws transport host header import
This commit is contained in:
parent
a76cdff0f2
commit
be9fa2b077
@ -96,7 +96,12 @@ namespace Configs {
|
||||
if (object.contains("path")) path = object["path"].toString();
|
||||
if (object.contains("method")) method = object["method"].toString();
|
||||
if (object.contains("headers") && object["headers"].isObject()) {
|
||||
headers = jsonObjectToQStringList(object["headers"].toObject());
|
||||
auto headerObj = object["headers"].toObject();
|
||||
if (type == "ws") {
|
||||
if (headerObj.contains("Host")) host = headerObj["Host"].toString();
|
||||
headerObj.remove("Host");
|
||||
}
|
||||
headers = jsonObjectToQStringList(headerObj);
|
||||
}
|
||||
if (object.contains("idle_timeout")) idle_timeout = object["idle_timeout"].toString();
|
||||
if (object.contains("ping_timeout")) ping_timeout = object["ping_timeout"].toString();
|
||||
@ -144,7 +149,7 @@ namespace Configs {
|
||||
if (type == "http" || type == "httpupgrade") object["host"] = host;
|
||||
if (type == "ws") {
|
||||
auto headersObj = object["headers"].isObject() ? object["headers"].toObject() : QJsonObject();
|
||||
headersObj["host"] = host;
|
||||
headersObj["Host"] = host;
|
||||
object["headers"] = headersObj;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user