|
|
|
@ -1550,10 +1550,71 @@ VOID TEST(ProtocolHTTPTest, HTTPMessageParser)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID TEST(ProtocolHTTPTest, VhostInQuery)
|
|
|
|
|
{
|
|
|
|
|
srs_error_t err;
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
|
|
|
|
|
SrsHttpMessage m;
|
|
|
|
|
HELPER_ASSERT_SUCCESS(m.set_url("/api/v1?vhost=rt.ossrs.net&token=xxx", false));
|
|
|
|
|
m.set_header(&h, false);
|
|
|
|
|
EXPECT_STREQ("rt.ossrs.net", m.host().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
|
|
|
|
|
SrsHttpMessage m;
|
|
|
|
|
HELPER_ASSERT_SUCCESS(m.set_url("/api/v1?vhost=rt.ossrs.net&&token=xxx", false));
|
|
|
|
|
m.set_header(&h, false);
|
|
|
|
|
EXPECT_STREQ("rt.ossrs.net", m.host().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
h.set("Host", "ossrs.net:-1");
|
|
|
|
|
|
|
|
|
|
SrsHttpMessage m;
|
|
|
|
|
HELPER_ASSERT_SUCCESS(m.set_url("/api/v1?vhost=rt.ossrs.net", false));
|
|
|
|
|
m.set_header(&h, false);
|
|
|
|
|
EXPECT_STREQ("rt.ossrs.net", m.host().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
|
|
|
|
|
SrsHttpMessage m;
|
|
|
|
|
HELPER_ASSERT_SUCCESS(m.set_url("/api/v1?vhost=ossrs.net", false));
|
|
|
|
|
m.set_header(&h, false);
|
|
|
|
|
EXPECT_STREQ("ossrs.net", m.host().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
h.set("Host", "ossrs.net");
|
|
|
|
|
|
|
|
|
|
SrsHttpMessage m;
|
|
|
|
|
m.set_header(&h, false);
|
|
|
|
|
HELPER_ASSERT_SUCCESS(m.set_url("/api/v1", false));
|
|
|
|
|
EXPECT_STREQ("ossrs.net", m.host().c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID TEST(ProtocolHTTPTest, HTTPMessageUpdate)
|
|
|
|
|
{
|
|
|
|
|
srs_error_t err;
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
|
|
|
|
|
SrsHttpMessage m;
|
|
|
|
|
HELPER_ASSERT_SUCCESS(m.set_url("/api/v1?vhost=ossrs.net", false));
|
|
|
|
|
m.set_header(&h, false);
|
|
|
|
|
EXPECT_STRNE("ossrs.net", m.host().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsHttpHeader h;
|
|
|
|
|
h.set("Host", "ossrs.net:-1");
|
|
|
|
|