@@ -535,27 +535,74 @@ TEST_F(UtilsFunctionTest, GetIOStreamLengthResetContentPositionTest)
535535
536536TEST_F (UtilsFunctionTest, CombineHostStringTest)
537537{
538- EXPECT_STREQ (CombineHostString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false ).c_str (),
538+ EXPECT_STREQ (CombineHostString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , false ).c_str (),
539539 " http://test-bucket.oss-cn-hangzhou.aliyuncs.com" );
540- EXPECT_STREQ (CombineHostString (" oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false ).c_str (),
540+ EXPECT_STREQ (CombineHostString (" oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , false ).c_str (),
541541 " http://test-bucket.oss-cn-hangzhou.aliyuncs.com" );
542- EXPECT_STREQ (CombineHostString (" http://192.168.1.1" , " test-bucket" , false ).c_str (),
542+ EXPECT_STREQ (CombineHostString (" http://192.168.1.1" , " test-bucket" , false , false ).c_str (),
543543 " http://192.168.1.1" );
544544
545- EXPECT_STREQ (CombineHostString (" http://cname.com" , " test-bucket" , true ).c_str (),
545+ EXPECT_STREQ (CombineHostString (" http://cname.com" , " test-bucket" , true , false ).c_str (),
546546 " http://cname.com" );
547- EXPECT_STREQ (CombineHostString (" cname.com" , " test-bucket" , true ).c_str (),
547+ EXPECT_STREQ (CombineHostString (" cname.com" , " test-bucket" , true , false ).c_str (),
548548 " http://cname.com" );
549- EXPECT_STREQ (CombineHostString (" http://192.168.1.1" , " test-bucket" , true ).c_str (),
549+ EXPECT_STREQ (CombineHostString (" http://192.168.1.1" , " test-bucket" , true , false ).c_str (),
550+ " http://192.168.1.1" );
551+
552+ // path style
553+ EXPECT_STREQ (CombineHostString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , true ).c_str (),
554+ " http://oss-cn-hangzhou.aliyuncs.com" );
555+ EXPECT_STREQ (CombineHostString (" oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , true ).c_str (),
556+ " http://oss-cn-hangzhou.aliyuncs.com" );
557+ EXPECT_STREQ (CombineHostString (" http://cname.com" , " test-bucket" , true , true ).c_str (),
558+ " http://cname.com" );
559+ EXPECT_STREQ (CombineHostString (" cname.com" , " test-bucket" , true , true ).c_str (),
560+ " http://cname.com" );
561+ EXPECT_STREQ (CombineHostString (" http://192.168.1.1" , " test-bucket" , true , true ).c_str (),
550562 " http://192.168.1.1" );
551563}
552564
553565TEST_F (UtilsFunctionTest, CombinePathStringTest)
554566{
555- EXPECT_STREQ (CombinePathString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , " test-key" ).c_str (),
567+ EXPECT_STREQ (CombinePathString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , " test-key" , false ).c_str (),
556568 " /test-key" );
557- EXPECT_STREQ (CombinePathString (" http://192.168.1.1" , " test-bucket" , " test-key" ).c_str (),
569+ EXPECT_STREQ (CombinePathString (" http://192.168.1.1" , " test-bucket" , " test-key" , false ).c_str (),
558570 " /test-bucket/test-key" );
571+
572+ // path style
573+ EXPECT_STREQ (CombinePathString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , " test-key" , true ).c_str (),
574+ " /test-bucket/test-key" );
575+ EXPECT_STREQ (CombinePathString (" http://192.168.1.1" , " test-bucket" , " test-key" , true ).c_str (),
576+ " /test-bucket/test-key" );
577+ }
578+
579+ TEST_F (UtilsFunctionTest, CombineRTMPStringTest)
580+ {
581+ EXPECT_STREQ (CombineRTMPString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , false ).c_str (),
582+ " rtmp://test-bucket.oss-cn-hangzhou.aliyuncs.com" );
583+ EXPECT_STREQ (CombineRTMPString (" oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , false ).c_str (),
584+ " rtmp://test-bucket.oss-cn-hangzhou.aliyuncs.com" );
585+ EXPECT_STREQ (CombineRTMPString (" http://192.168.1.1" , " test-bucket" , false , false ).c_str (),
586+ " rtmp://192.168.1.1" );
587+
588+ EXPECT_STREQ (CombineRTMPString (" http://cname.com" , " test-bucket" , true , false ).c_str (),
589+ " rtmp://cname.com" );
590+ EXPECT_STREQ (CombineRTMPString (" cname.com" , " test-bucket" , true , false ).c_str (),
591+ " rtmp://cname.com" );
592+ EXPECT_STREQ (CombineRTMPString (" http://192.168.1.1" , " test-bucket" , true , false ).c_str (),
593+ " rtmp://192.168.1.1" );
594+
595+ // path style
596+ EXPECT_STREQ (CombineRTMPString (" http://oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , true ).c_str (),
597+ " rtmp://oss-cn-hangzhou.aliyuncs.com" );
598+ EXPECT_STREQ (CombineRTMPString (" oss-cn-hangzhou.aliyuncs.com" , " test-bucket" , false , true ).c_str (),
599+ " rtmp://oss-cn-hangzhou.aliyuncs.com" );
600+ EXPECT_STREQ (CombineRTMPString (" http://cname.com" , " test-bucket" , true , true ).c_str (),
601+ " rtmp://cname.com" );
602+ EXPECT_STREQ (CombineRTMPString (" cname.com" , " test-bucket" , true , true ).c_str (),
603+ " rtmp://cname.com" );
604+ EXPECT_STREQ (CombineRTMPString (" http://192.168.1.1" , " test-bucket" , true , true ).c_str (),
605+ " rtmp://192.168.1.1" );
559606}
560607
561608TEST_F (UtilsFunctionTest, CombineQueryStringTest)
0 commit comments