Skip to content

Commit

Permalink
fix: v2ray http header
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Nov 9, 2022
1 parent 0b3af33 commit 59922b8
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions fmt/Bean2CoreObj_ray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ namespace NekoRay::fmt {
if (!path.isEmpty()) quic["key"] = path;
if (!host.isEmpty()) quic["security"] = host;
streamSettings["quicSettings"] = quic;
} else if (network == "tcp" && !header_type.isEmpty()) {
QJsonObject header{{"type", header_type}};
if (header_type == "http") {
header["request"] = QJsonObject{
{"path", QList2QJsonArray(path.split(","))},
{"headers", QJsonObject{{"Host", QList2QJsonArray(host.split(","))}}},
};
}
streamSettings["tcpSettings"] = QJsonObject{{"header", header}};
}

if (security == "tls") {
Expand All @@ -56,18 +65,6 @@ namespace NekoRay::fmt {
streamSettings["security"] = "tls";
}

if (!header_type.isEmpty()) {
QJsonObject header{{"type", header_type}};
if (header_type == "http") {
QJsonObject request{
{"path", QList2QJsonArray(path.split(","))},
{"headers", QJsonObject{{"Host", QList2QJsonArray(host.split(","))}}},
};
header["request"] = request;
}
streamSettings["header"] = header;
}

return streamSettings;
}

Expand Down

0 comments on commit 59922b8

Please sign in to comment.