mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix #1255, support vhost/domain in query string for HTTP streaming. 3.0.90
This commit is contained in:
parent
8a28a11648
commit
eb8e7ad479
5 changed files with 77 additions and 4 deletions
|
@ -146,6 +146,7 @@ For previous versions, please read:
|
||||||
|
|
||||||
## V3 changes
|
## V3 changes
|
||||||
|
|
||||||
|
* v3.0, 2019-12-29, For [#1255][bug #1255], support vhost/domain in query string for HTTP streaming. 3.0.90
|
||||||
* v3.0, 2019-12-29, For [#299][bug #299], increase dash segment size for avsync issue. 3.0.89
|
* v3.0, 2019-12-29, For [#299][bug #299], increase dash segment size for avsync issue. 3.0.89
|
||||||
* v3.0, 2019-12-27, For [#299][bug #299], fix some bugs in dash, it works now. 3.0.88
|
* v3.0, 2019-12-27, For [#299][bug #299], fix some bugs in dash, it works now. 3.0.88
|
||||||
* v3.0, 2019-12-27, For [#1544][bug #1544], fix memory leaking for complex error. 3.0.87
|
* v3.0, 2019-12-27, For [#1544][bug #1544], fix memory leaking for complex error. 3.0.87
|
||||||
|
@ -1573,6 +1574,7 @@ Winlin
|
||||||
[bug #1282]: https://github.com/ossrs/srs/issues/1282
|
[bug #1282]: https://github.com/ossrs/srs/issues/1282
|
||||||
[bug #1105]: https://github.com/ossrs/srs/issues/1105
|
[bug #1105]: https://github.com/ossrs/srs/issues/1105
|
||||||
[bug #1544]: https://github.com/ossrs/srs/issues/1544
|
[bug #1544]: https://github.com/ossrs/srs/issues/1544
|
||||||
|
[bug #1255]: https://github.com/ossrs/srs/issues/1255
|
||||||
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx
|
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx
|
||||||
|
|
||||||
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
// The version config.
|
// The version config.
|
||||||
#define VERSION_MAJOR 3
|
#define VERSION_MAJOR 3
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 89
|
#define VERSION_REVISION 90
|
||||||
|
|
||||||
// The macros generated by configure script.
|
// The macros generated by configure script.
|
||||||
#include <srs_auto_headers.hpp>
|
#include <srs_auto_headers.hpp>
|
||||||
|
|
|
@ -491,6 +491,16 @@ string SrsHttpMessage::url()
|
||||||
|
|
||||||
string SrsHttpMessage::host()
|
string SrsHttpMessage::host()
|
||||||
{
|
{
|
||||||
|
std::map<string, string>::iterator it = _query.find("vhost");
|
||||||
|
if (it != _query.end() && !it->second.empty()) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
it = _query.find("domain");
|
||||||
|
if (it != _query.end() && !it->second.empty()) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
return _uri->get_host();
|
return _uri->get_host();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1820,9 +1820,9 @@ VOID TEST(ConfigUnitTest, CheckDefaultValuesVhost)
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF));
|
||||||
EXPECT_EQ(3 * SRS_UTIME_SECONDS, conf.get_dash_fragment(""));
|
EXPECT_EQ(30 * SRS_UTIME_SECONDS, conf.get_dash_fragment(""));
|
||||||
EXPECT_EQ(30 * SRS_UTIME_SECONDS, conf.get_dash_update_period(""));
|
EXPECT_EQ(150 * SRS_UTIME_SECONDS, conf.get_dash_update_period(""));
|
||||||
EXPECT_EQ(60 * SRS_UTIME_SECONDS, conf.get_dash_timeshift(""));
|
EXPECT_EQ(300 * SRS_UTIME_SECONDS, conf.get_dash_timeshift(""));
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{dash{dash_fragment 4;dash_update_period 40;dash_timeshift 70;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{dash{dash_fragment 4;dash_update_period 40;dash_timeshift 70;}}"));
|
||||||
EXPECT_EQ(4 * SRS_UTIME_SECONDS, conf.get_dash_fragment("v"));
|
EXPECT_EQ(4 * SRS_UTIME_SECONDS, conf.get_dash_fragment("v"));
|
||||||
|
|
|
@ -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)
|
VOID TEST(ProtocolHTTPTest, HTTPMessageUpdate)
|
||||||
{
|
{
|
||||||
srs_error_t err;
|
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) {
|
if (true) {
|
||||||
SrsHttpHeader h;
|
SrsHttpHeader h;
|
||||||
h.set("Host", "ossrs.net:-1");
|
h.set("Host", "ossrs.net:-1");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue