1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTMP URL supports domain in stream parameters. v4.0.255

This commit is contained in:
winlin 2022-08-17 11:08:32 +08:00
parent febd45d514
commit f9941a325b
5 changed files with 45 additions and 7 deletions

View file

@ -8,6 +8,7 @@ The changelog for SRS.
## SRS 4.0 Changelog ## SRS 4.0 Changelog
* v4.0, 2022-08-17, RTMP URL supports domain in stream parameters. v4.0.255
* v4.0, 2022-08-10, Fix server id generator bug. v4.0.254 * v4.0, 2022-08-10, Fix server id generator bug. v4.0.254
* v4.0, 2022-06-29, Update SRS image for r.ossrs.net. v4.0.253 * v4.0, 2022-06-29, Update SRS image for r.ossrs.net. v4.0.253
* v4.0, 2022-06-11, For [#3058](https://github.com/ossrs/srs/pull/3058): Docker: Support x86_64, armv7 and aarch64 docker image (#3058). v4.0.252 * v4.0, 2022-06-11, For [#3058](https://github.com/ossrs/srs/pull/3058): Docker: Support x86_64, armv7 and aarch64 docker image (#3058). v4.0.252

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4 #define VERSION_MAJOR 4
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 254 #define VERSION_REVISION 255
#endif #endif

View file

@ -59,6 +59,11 @@ void srs_vhost_resolve(string& vhost, string& app, string& param)
if (!query.empty()) { if (!query.empty()) {
vhost = query; vhost = query;
} }
} else if ((pos = query.find("domain?")) != std::string::npos) {
query = query.substr(pos + 7);
if (!query.empty()) {
vhost = query;
}
} }
} }

View file

@ -3388,6 +3388,20 @@ VOID TEST(ProtocolRTMPTest, DiscoveryTcUrl)
EXPECT_STREQ("?key=abc&&vhost=demo.com", param.c_str()); EXPECT_STREQ("?key=abc&&vhost=demo.com", param.c_str());
} }
if (true) {
int port; std::string tcUrl, schema, ip, vhost, app, stream, param;
tcUrl = "rtmp://winlin.cn/live"; stream= "show?key=abc&&domain=demo.com";
srs_discovery_tc_url(tcUrl, schema, ip, vhost, app, stream, port, param);
EXPECT_STREQ("rtmp", schema.c_str());
EXPECT_STREQ("winlin.cn", ip.c_str());
EXPECT_STREQ("demo.com", vhost.c_str());
EXPECT_STREQ("live", app.c_str());
EXPECT_STREQ("show", stream.c_str());
EXPECT_EQ(1935, port);
EXPECT_STREQ("?key=abc&&domain=demo.com", param.c_str());
}
// vhost in app // vhost in app
if (true) { if (true) {
int port; std::string tcUrl, schema, ip, vhost, app, stream, param; int port; std::string tcUrl, schema, ip, vhost, app, stream, param;

View file

@ -539,6 +539,24 @@ VOID TEST(HTTPServerTest, MessageConnection)
EXPECT_STREQ("ossrs.net", m.host().c_str()); EXPECT_FALSE(m.is_jsonp()); EXPECT_STREQ("ossrs.net", m.host().c_str()); EXPECT_FALSE(m.is_jsonp());
} }
if (true) {
SrsHttpMessage m;
HELPER_EXPECT_SUCCESS(m.set_url("http://127.0.0.1/live/livestream.flv?vhost=ossrs.net", false));
EXPECT_STREQ("ossrs.net", m.host().c_str()); EXPECT_FALSE(m.is_jsonp());
}
if (true) {
SrsHttpMessage m;
HELPER_EXPECT_SUCCESS(m.set_url("http://127.0.0.1/live/livestream.flv?domain=ossrs.net&token=xxx", false));
EXPECT_STREQ("ossrs.net", m.host().c_str()); EXPECT_FALSE(m.is_jsonp());
}
if (true) {
SrsHttpMessage m;
HELPER_EXPECT_SUCCESS(m.set_url("http://127.0.0.1/live/livestream.flv?token=xxx&domain=ossrs.net", false));
EXPECT_STREQ("ossrs.net", m.host().c_str()); EXPECT_FALSE(m.is_jsonp());
}
if (true) { if (true) {
SrsHttpMessage m; SrsHttpMessage m;
HELPER_EXPECT_SUCCESS(m.set_url("http://127.0.0.1/live/livestream.flv", false)); HELPER_EXPECT_SUCCESS(m.set_url("http://127.0.0.1/live/livestream.flv", false));