From e0661c5e737924a81f640134b23cdacc5c96a7d7 Mon Sep 17 00:00:00 2001 From: Qv2ray-dev <59914293+Qv2ray-dev@users.noreply.github.com> Date: Thu, 6 Aug 2020 10:48:14 +0800 Subject: [PATCH] fix: do not export host/port/encryption when using type=original --- core/Serializer.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/Serializer.hpp b/core/Serializer.hpp index 1ccfe1a..fa30c0f 100644 --- a/core/Serializer.hpp +++ b/core/Serializer.hpp @@ -29,13 +29,15 @@ class TrojanGoSerializer : public Qv2rayPlugin::QvPluginSerializer // query.addQueryItem("sni", obj.sni); query.addQueryItem("type", TRANSPORT_TYPE_STRING_MAP[obj.type]); - query.addQueryItem("host", QUrl::toPercentEncoding(obj.host)); - query.addQueryItem("path", QUrl::toPercentEncoding(obj.path)); - if (!obj.encryption.isEmpty()) - query.addQueryItem("encryption", QUrl::toPercentEncoding(obj.encryption)); - if (!obj.plugin.isEmpty()) - query.addQueryItem("plugin", QUrl::toPercentEncoding(obj.plugin)); - + if (obj.type == TRANSPORT_WEBSOCKET) + { + query.addQueryItem("host", QUrl::toPercentEncoding(obj.host)); + query.addQueryItem("path", QUrl::toPercentEncoding(obj.path)); + if (!obj.encryption.isEmpty()) + query.addQueryItem("encryption", QUrl::toPercentEncoding(obj.encryption)); + if (!obj.plugin.isEmpty()) + query.addQueryItem("plugin", QUrl::toPercentEncoding(obj.plugin)); + } url.setQuery(query); return url.toString(QUrl::FullyDecoded); }