mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix #2881: HTTP: Support merging api to server. v5.0.47
This commit is contained in:
parent
6508a082e9
commit
457738f6eb
34 changed files with 333 additions and 934 deletions
|
@ -3558,6 +3558,58 @@ VOID TEST(ConfigMainTest, CheckVhostConfig4)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckHttpListen)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "http_api{enabled on;listen xxx;}http_server{enabled on;listen xxx;}"));
|
||||
EXPECT_TRUE(conf.get_http_stream_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_stream_listen().c_str());
|
||||
EXPECT_STREQ("xxx", conf.get_http_api_listen().c_str());
|
||||
EXPECT_TRUE(conf.get_http_stream_crossdomain());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "http_api{enabled on;listen xxx;}http_server{enabled on;listen xxx;}"));
|
||||
EXPECT_TRUE(conf.get_http_stream_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_stream_listen().c_str());
|
||||
EXPECT_STREQ("8088", conf.get_https_stream_listen().c_str());
|
||||
EXPECT_STREQ("xxx", conf.get_http_api_listen().c_str());
|
||||
EXPECT_STREQ("8088", conf.get_https_api_listen().c_str());
|
||||
EXPECT_TRUE(conf.get_http_stream_crossdomain());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "http_api{enabled on;listen mmm;https{enabled on;listen zzz;}}http_server{enabled on;listen xxx;https{enabled on;listen yyy;}}"));
|
||||
EXPECT_TRUE(conf.get_http_stream_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_stream_listen().c_str());
|
||||
EXPECT_STREQ("yyy", conf.get_https_stream_listen().c_str());
|
||||
EXPECT_STREQ("mmm", conf.get_http_api_listen().c_str());
|
||||
EXPECT_STREQ("zzz", conf.get_https_api_listen().c_str());
|
||||
EXPECT_TRUE(conf.get_http_stream_crossdomain());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "http_api{enabled on;listen xxx;https{enabled on;listen yyy;}}http_server{enabled on;listen xxx;https{enabled on;listen yyy;}}"));
|
||||
EXPECT_TRUE(conf.get_http_stream_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_stream_listen().c_str());
|
||||
EXPECT_STREQ("yyy", conf.get_https_stream_listen().c_str());
|
||||
EXPECT_STREQ("xxx", conf.get_http_api_listen().c_str());
|
||||
EXPECT_STREQ("yyy", conf.get_https_api_listen().c_str());
|
||||
EXPECT_TRUE(conf.get_http_stream_crossdomain());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
HELPER_ASSERT_FAILED(conf.parse(_MIN_OK_CONF "http_api{enabled on;listen xxx;https{enabled on;listen zzz;}}http_server{enabled on;listen xxx;https{enabled on;listen yyy;}}"));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckVhostConfig5)
|
||||
{
|
||||
srs_error_t err;
|
||||
|
@ -3803,8 +3855,8 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
|
||||
conf.mock_include("./conf/include_test/include_3.conf", "hls {enabled on;hls_path xxx;hls_m3u8_file xxx1;hls_ts_file xxx2;hls_fragment 10;hls_window 60;}");
|
||||
conf.mock_include("./conf/include_test/include_4.conf", "listen 1935;max_connections 1000;daemon off;srs_log_tank console;include ./conf/include_test/include_5.conf;vhost ossrs.net {include ./conf/include_test/include_3.conf;}include ./conf/include_test/include_6.conf;");
|
||||
conf.mock_include("./conf/include_test/include_5.conf", "http_server {enabled on;listen xxx;dir xxx2;}");
|
||||
conf.mock_include("./conf/include_test/include_6.conf", "http_api {enabled on;listen xxx;}");
|
||||
conf.mock_include("./conf/include_test/include_5.conf", "http_server {enabled on;listen 8080;dir xxx2;}");
|
||||
conf.mock_include("./conf/include_test/include_6.conf", "http_api {enabled on;listen 1985;}");
|
||||
|
||||
HELPER_ASSERT_SUCCESS(conf.parse("include ./conf/include_test/include_4.conf;"));
|
||||
|
||||
|
@ -3815,7 +3867,7 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
EXPECT_FALSE(conf.get_log_tank_file());
|
||||
|
||||
EXPECT_TRUE(conf.get_http_stream_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_stream_listen().c_str());
|
||||
EXPECT_STREQ("8080", conf.get_http_stream_listen().c_str());
|
||||
EXPECT_STREQ("xxx2", conf.get_http_stream_dir().c_str());
|
||||
|
||||
EXPECT_TRUE(conf.get_hls_enabled("ossrs.net"));
|
||||
|
@ -3826,7 +3878,7 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
EXPECT_EQ(60*SRS_UTIME_SECONDS, conf.get_hls_window("ossrs.net"));
|
||||
|
||||
EXPECT_TRUE(conf.get_http_api_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_api_listen().c_str());
|
||||
EXPECT_STREQ("1985", conf.get_http_api_listen().c_str());
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
@ -3835,7 +3887,7 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
conf.mock_include("./conf/include_test/include_3.conf", "hls {enabled on;hls_path xxx;hls_m3u8_file xxx1;hls_ts_file xxx2;hls_fragment 10;hls_window 60;}");
|
||||
conf.mock_include("./conf/include_test/include_4.conf", "listen 1935;max_connections 1000;daemon off;srs_log_tank console;include ./conf/include_test/include_5.conf ./conf/include_test/include_6.conf;vhost ossrs.net {include ./conf/include_test/include_3.conf;}");
|
||||
conf.mock_include("./conf/include_test/include_5.conf", "http_server {enabled on;listen xxx;dir xxx2;}");
|
||||
conf.mock_include("./conf/include_test/include_6.conf", "http_api {enabled on;listen xxx;}");
|
||||
conf.mock_include("./conf/include_test/include_6.conf", "http_api {enabled on;listen yyy;}");
|
||||
|
||||
HELPER_ASSERT_SUCCESS(conf.parse("include ./conf/include_test/include_4.conf;"));
|
||||
|
||||
|
@ -3850,7 +3902,7 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
EXPECT_STREQ("xxx2", conf.get_http_stream_dir().c_str());
|
||||
|
||||
EXPECT_TRUE(conf.get_http_api_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_api_listen().c_str());
|
||||
EXPECT_STREQ("yyy", conf.get_http_api_listen().c_str());
|
||||
|
||||
EXPECT_TRUE(conf.get_hls_enabled("ossrs.net"));
|
||||
EXPECT_STREQ("xxx", conf.get_hls_path("ossrs.net").c_str());
|
||||
|
@ -3866,7 +3918,7 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
conf.mock_include("./conf/include_test/include_3.conf", "hls {enabled on;hls_path xxx;hls_m3u8_file xxx1;hls_ts_file xxx2;hls_fragment 10;hls_window 60;}");
|
||||
conf.mock_include("./conf/include_test/include_4.conf", "listen 1935;max_connections 1000;daemon off;srs_log_tank console;include ./conf/include_test/include_5.conf ./conf/include_test/include_6.conf;vhost ossrs.net {include ./conf/include_test/include_3.conf ./conf/include_test/include_7.conf;}");
|
||||
conf.mock_include("./conf/include_test/include_5.conf", "http_server {enabled on;listen xxx;dir xxx2;}");
|
||||
conf.mock_include("./conf/include_test/include_6.conf", "http_api {enabled on;listen xxx;}");
|
||||
conf.mock_include("./conf/include_test/include_6.conf", "http_api {enabled on;listen yyy;}");
|
||||
conf.mock_include("./conf/include_test/include_7.conf", "dash{enabled on;dash_fragment 10;dash_update_period 10;dash_timeshift 10;dash_path xxx;dash_mpd_file xxx2;}");
|
||||
|
||||
HELPER_ASSERT_SUCCESS(conf.parse("include ./conf/include_test/include_4.conf;"));
|
||||
|
@ -3882,7 +3934,7 @@ VOID TEST(ConfigMainTest, CheckIncludeConfig)
|
|||
EXPECT_STREQ("xxx2", conf.get_http_stream_dir().c_str());
|
||||
|
||||
EXPECT_TRUE(conf.get_http_api_enabled());
|
||||
EXPECT_STREQ("xxx", conf.get_http_api_listen().c_str());
|
||||
EXPECT_STREQ("yyy", conf.get_http_api_listen().c_str());
|
||||
|
||||
EXPECT_TRUE(conf.get_hls_enabled("ossrs.net"));
|
||||
EXPECT_STREQ("xxx", conf.get_hls_path("ossrs.net").c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue