Skip to content

Commit dc7be76

Browse files
winlinvipmapengfei53chundonglinlin
authored
Forward add question mark to the end. v6.0.30 (#3438)
Co-authored-by: pengfei.ma <[email protected]> Co-authored-by: chundonglinlin <[email protected]>
1 parent 6786724 commit dc7be76

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

trunk/doc/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The changelog for SRS.
88

99
## SRS 6.0 Changelog
1010

11+
* 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)
1112
* 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)
1213
* 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)
1314
* v6.0, 2023-02-22, Compatible with legacy RTMP URL. v6.0.27

trunk/src/core/srs_core_version6.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
#define VERSION_MAJOR 6
1111
#define VERSION_MINOR 0
12-
#define VERSION_REVISION 29
12+
#define VERSION_REVISION 30
1313

1414
#endif

trunk/src/protocol/srs_protocol_utility.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ string srs_generate_stream_with_query(string host, string vhost, string stream,
238238
}
239239
}
240240

241-
// Remove the start & when param is empty.
242-
query = srs_string_trim_start(query, "&");
241+
// Remove the start & and ? when param is empty.
242+
query = srs_string_trim_start(query, "&?");
243243

244244
// Prefix query with ?.
245245
if (!query.empty() && !srs_string_starts_with(query, "?")) {

trunk/src/utest/srs_utest_rtmp.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,6 +3049,34 @@ VOID TEST(ProtocolRTMPTest, GenerateURL)
30493049
}
30503050
}
30513051

3052+
VOID TEST(ProtocolRTMPTest, GenerateURLForFFmpeg)
3053+
{
3054+
// For https://github.com/ossrs/srs/issues/3405
3055+
if (true) {
3056+
string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?vhost=localhost");
3057+
string url = srs_generate_stream_with_query(host, vhost, stream, param, false);
3058+
EXPECT_STREQ("stream", url.c_str());
3059+
}
3060+
3061+
if (true) {
3062+
string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?k=v&vhost=localhost");
3063+
string url = srs_generate_stream_with_query(host, vhost, stream, param, false);
3064+
EXPECT_STREQ("stream?k=v", url.c_str());
3065+
}
3066+
3067+
if (true) {
3068+
string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?vhost=localhost&k=v");
3069+
string url = srs_generate_stream_with_query(host, vhost, stream, param, false);
3070+
EXPECT_STREQ("stream?k=v", url.c_str());
3071+
}
3072+
3073+
if (true) {
3074+
string host("192.168.1.100"), vhost("localhost"), stream("stream"), param("?k=v");
3075+
string url = srs_generate_stream_with_query(host, vhost, stream, param, false);
3076+
EXPECT_STREQ("stream?k=v", url.c_str());
3077+
}
3078+
}
3079+
30523080
VOID TEST(ProtocolRTMPTest, DiscoveryTcUrlLegacy)
30533081
{
30543082
if (true) {

0 commit comments

Comments
 (0)