From 153310109cce1aa2b40a329fd6daa305a63c24ed Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 25 Feb 2023 18:39:18 +0800 Subject: [PATCH 1/3] Forward add question mark to the end and Erroneous C2. --- trunk/src/core/srs_core_version5.hpp | 2 +- trunk/src/core/srs_core_version6.hpp | 2 +- trunk/src/protocol/srs_protocol_utility.cpp | 2 +- trunk/src/utest/srs_utest_rtmp.cpp | 28 +++++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index 9814f77e11..46ff71091e 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 143 +#define VERSION_REVISION 144 #endif diff --git a/trunk/src/core/srs_core_version6.hpp b/trunk/src/core/srs_core_version6.hpp index 089adec668..cb9ab95591 100644 --- a/trunk/src/core/srs_core_version6.hpp +++ b/trunk/src/core/srs_core_version6.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 6 #define VERSION_MINOR 0 -#define VERSION_REVISION 29 +#define VERSION_REVISION 30 #endif diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index 3607259d94..59ff67ffb5 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -239,7 +239,7 @@ string srs_generate_stream_with_query(string host, string vhost, string stream, } // Remove the start & when param is empty. - query = srs_string_trim_start(query, "&"); + query = srs_string_trim_start(query, "&?"); // Prefix query with ?. if (!query.empty() && !srs_string_starts_with(query, "?")) { diff --git a/trunk/src/utest/srs_utest_rtmp.cpp b/trunk/src/utest/srs_utest_rtmp.cpp index b4ebc6e23f..b5535d61b0 100644 --- a/trunk/src/utest/srs_utest_rtmp.cpp +++ b/trunk/src/utest/srs_utest_rtmp.cpp @@ -3049,6 +3049,34 @@ VOID TEST(ProtocolRTMPTest, GenerateURL) } } +VOID TEST(ProtocolRTMPTest, GenerateURLForFFmpeg) +{ + // For https://github.com/ossrs/srs/issues/3405 + if (true) { + string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?vhost=localhost"); + string url = srs_generate_stream_with_query(host, vhost, stream, param, false); + EXPECT_STREQ("stream", url.c_str()); + } + + if (true) { + string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?k=v&vhost=localhost"); + string url = srs_generate_stream_with_query(host, vhost, stream, param, false); + EXPECT_STREQ("stream?k=v", url.c_str()); + } + + if (true) { + string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?vhost=localhost&k=v"); + string url = srs_generate_stream_with_query(host, vhost, stream, param, false); + EXPECT_STREQ("stream?k=v", url.c_str()); + } + + if (true) { + string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?k=v"); + string url = srs_generate_stream_with_query(host, vhost, stream, param, false); + EXPECT_STREQ("stream?k=v", url.c_str()); + } +} + VOID TEST(ProtocolRTMPTest, DiscoveryTcUrlLegacy) { if (true) { From 5e1c9a19e5376f3992343a9c42741e76c68c68e8 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 25 Feb 2023 18:43:12 +0800 Subject: [PATCH 2/3] Update release to v6.0.30 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/core/srs_core_version5.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index e8da97b348..774e648244 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 6.0 Changelog +* v6.0, 2023-02-25, Merge [#3438](https://github.com/ossrs/srs/pull/3438): Forward add question mark to the end. v6.0.30 (#3438) * v6.0, 2023-02-25, Merge [#3416](https://github.com/ossrs/srs/pull/3416): GB: Support HEVC for regression test and load tool for GB. v6.0.29 (#3416) * v6.0, 2023-02-25, Merge [#3424](https://github.com/ossrs/srs/pull/3424): API: Add service_id for http_hooks, which identify the process. v6.0.28 (#3424) * v6.0, 2023-02-22, Compatible with legacy RTMP URL. v6.0.27 diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index 46ff71091e..9814f77e11 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 144 +#define VERSION_REVISION 143 #endif From 0b807e5ea11349136b76cbccbebcac4245f42a8e Mon Sep 17 00:00:00 2001 From: "pengfei.ma" Date: Sat, 25 Feb 2023 18:53:49 +0800 Subject: [PATCH 3/3] fix error --- trunk/src/protocol/srs_protocol_utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index 59ff67ffb5..efddea33f4 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -238,7 +238,7 @@ string srs_generate_stream_with_query(string host, string vhost, string stream, } } - // Remove the start & when param is empty. + // Remove the start & and ? when param is empty. query = srs_string_trim_start(query, "&?"); // Prefix query with ?.