mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-18 20:50:09 +08:00
fix ws host header
This commit is contained in:
parent
732f649bee
commit
00155b1c9d
@ -72,17 +72,10 @@ namespace Configs {
|
|||||||
method = "GET";
|
method = "GET";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (query.hasQueryItem("host")) {
|
if (query.hasQueryItem("host")) host = query.queryItemValue("host");
|
||||||
host = query.queryItemValue("host");
|
|
||||||
if (type == "ws") headers << "host" << host;
|
|
||||||
}
|
|
||||||
if (query.hasQueryItem("path")) path = query.queryItemValue("path");
|
if (query.hasQueryItem("path")) path = query.queryItemValue("path");
|
||||||
if (query.hasQueryItem("method")) method = query.queryItemValue("method");
|
if (query.hasQueryItem("method")) method = query.queryItemValue("method");
|
||||||
if (query.hasQueryItem("headers")) {
|
if (query.hasQueryItem("headers")) headers = query.queryItemValue("headers").split(",");
|
||||||
auto headersImported = query.queryItemValue("headers").split(",");
|
|
||||||
if (headersImported.contains("host")) headers = headersImported;
|
|
||||||
else headers << headersImported;
|
|
||||||
}
|
|
||||||
if (query.hasQueryItem("idle_timeout")) idle_timeout = query.queryItemValue("idle_timeout");
|
if (query.hasQueryItem("idle_timeout")) idle_timeout = query.queryItemValue("idle_timeout");
|
||||||
if (query.hasQueryItem("ping_timeout")) ping_timeout = query.queryItemValue("ping_timeout");
|
if (query.hasQueryItem("ping_timeout")) ping_timeout = query.queryItemValue("ping_timeout");
|
||||||
if (query.hasQueryItem("max_early_data")) max_early_data = query.queryItemValue("max_early_data").toInt();
|
if (query.hasQueryItem("max_early_data")) max_early_data = query.queryItemValue("max_early_data").toInt();
|
||||||
@ -128,12 +121,19 @@ namespace Configs {
|
|||||||
QJsonObject object;
|
QJsonObject object;
|
||||||
if (type.isEmpty() || type == "tcp") return object;
|
if (type.isEmpty() || type == "tcp") return object;
|
||||||
if (!type.isEmpty()) object["type"] = type;
|
if (!type.isEmpty()) object["type"] = type;
|
||||||
if (!host.isEmpty() && (type == "http" || type == "httpupgrade")) object["host"] = host;
|
|
||||||
if (!path.isEmpty()) object["path"] = path;
|
if (!path.isEmpty()) object["path"] = path;
|
||||||
if (!method.isEmpty()) object["method"] = method;
|
if (!method.isEmpty()) object["method"] = method;
|
||||||
if (!headers.isEmpty()) {
|
if (!headers.isEmpty()) {
|
||||||
object["headers"] = qStringListToJsonObject(headers);
|
object["headers"] = qStringListToJsonObject(headers);
|
||||||
}
|
}
|
||||||
|
if (!host.isEmpty()) {
|
||||||
|
if (type == "http" || type == "httpupgrade") object["host"] = host;
|
||||||
|
if (type == "ws") {
|
||||||
|
auto headersObj = object["headers"].isObject() ? object["headers"].toObject() : QJsonObject();
|
||||||
|
headersObj["host"] = host;
|
||||||
|
object["headers"] = headersObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!idle_timeout.isEmpty()) object["idle_timeout"] = idle_timeout;
|
if (!idle_timeout.isEmpty()) object["idle_timeout"] = idle_timeout;
|
||||||
if (!ping_timeout.isEmpty()) object["ping_timeout"] = ping_timeout;
|
if (!ping_timeout.isEmpty()) object["ping_timeout"] = ping_timeout;
|
||||||
if (max_early_data > 0) object["max_early_data"] = max_early_data;
|
if (max_early_data > 0) object["max_early_data"] = max_early_data;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user