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

For #1575, use RTMP redirect as tcUrl and redirect2 as RTMP URL. 3.0.100

This commit is contained in:
winlin 2020-01-16 14:28:05 +08:00
parent 7240fe3040
commit 0e750ab3eb
8 changed files with 47 additions and 17 deletions

View file

@ -1751,7 +1751,8 @@ VOID TEST(ProtocolRTMPTest, ServerRedirect)
string host = "target.net";
int port = 8888;
bool accepted = false;
HELPER_EXPECT_SUCCESS(r.redirect(&req, host, port, accepted));
string rurl = srs_generate_rtmp_url(host, port, req.host, req.vhost, req.app, req.stream, req.param);
HELPER_EXPECT_SUCCESS(r.redirect(&req, rurl, accepted));
if (true) {
MockBufferIO tio;
@ -1776,6 +1777,14 @@ VOID TEST(ProtocolRTMPTest, ServerRedirect)
prop = ex->get_property("redirect");
ASSERT_TRUE(prop && prop->is_string());
// The recirect is tcUrl, not RTMP URL.
// https://github.com/ossrs/srs/issues/1575#issuecomment-574995475
EXPECT_STREQ("rtmp://target.net:8888/live", prop->to_str().c_str());
prop = ex->get_property("redirect2");
ASSERT_TRUE(prop && prop->is_string());
// The recirect2 is RTMP URL.
// https://github.com/ossrs/srs/issues/1575#issuecomment-574999798
EXPECT_STREQ("rtmp://target.net:8888/live/livestream", prop->to_str().c_str());
srs_freep(msg);
@ -1808,7 +1817,8 @@ VOID TEST(ProtocolRTMPTest, ServerRedirect)
string host = "target.net";
int port = 8888;
bool accepted = false;
HELPER_EXPECT_SUCCESS(r.redirect(&req, host, port, accepted));
string rurl = srs_generate_rtmp_url(host, port, req.host, req.vhost, req.app, req.stream, req.param);
HELPER_EXPECT_SUCCESS(r.redirect(&req, rurl, accepted));
EXPECT_TRUE(accepted);
if (true) {
@ -1834,6 +1844,14 @@ VOID TEST(ProtocolRTMPTest, ServerRedirect)
prop = ex->get_property("redirect");
ASSERT_TRUE(prop && prop->is_string());
// The recirect is tcUrl, not RTMP URL.
// https://github.com/ossrs/srs/issues/1575#issuecomment-574995475
EXPECT_STREQ("rtmp://target.net:8888/live", prop->to_str().c_str());
prop = ex->get_property("redirect2");
ASSERT_TRUE(prop && prop->is_string());
// The recirect2 is RTMP URL.
// https://github.com/ossrs/srs/issues/1575#issuecomment-574999798
EXPECT_STREQ("rtmp://target.net:8888/live/livestream", prop->to_str().c_str());
srs_freep(msg);