mirror of
https://github.com/ossrs/srs.git
synced 2025-02-14 20:31:56 +00:00
Merge branch v5.0.106 into develop
* Build: Refine cygwin64 test script. * API: Parse fragment of URI. v5.0.106 (#3295)
This commit is contained in:
commit
3049fa70eb
7 changed files with 43 additions and 5 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -55,7 +55,7 @@ jobs:
|
|||
shell: C:\cygwin64\bin\bash.exe --login '{0}'
|
||||
run: |
|
||||
WORKDIR=$(cygpath -u $SRS_WORKSPACE) && export PATH=/usr/bin:/usr/local/bin && cd ${WORKDIR} &&
|
||||
pwd && ls -lh && rm -rf trunk/objs && tar xf objs.tar.bz2 -C trunk/ && du -sh trunk/* &&
|
||||
pwd && ls -lh && rm -rf trunk/objs && tar xf objs.tar.bz2 -C trunk/ && du -sh trunk/* && du -sh trunk/objs/* &&
|
||||
cd ${WORKDIR}/trunk && ./configure --gb28181=on --utest=on && make utest && ./objs/srs_utest
|
||||
outputs:
|
||||
SRS_CYGWIN_DONE: ok
|
||||
|
|
|
@ -19,6 +19,7 @@ The changelog for SRS.
|
|||
|
||||
## SRS 5.0 Changelog
|
||||
|
||||
* v5.0, 2022-12-08, Merge [#3295](https://github.com/ossrs/srs/pull/3295): API: Parse fragment of URI. v5.0.106
|
||||
* v5.0, 2022-12-04, Cygwin: Enable gb28181 for Windows. v5.0.105
|
||||
* v5.0, 2022-12-04, Asan: Set asan loging callback. v5.0.104
|
||||
* v5.0, 2022-12-02, GB28181: Enable GB for CentOS 7 package. v5.0.103
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 105
|
||||
#define VERSION_REVISION 106
|
||||
|
||||
#endif
|
||||
|
|
|
@ -931,7 +931,7 @@ SrsHttpUri::~SrsHttpUri()
|
|||
|
||||
srs_error_t SrsHttpUri::initialize(string url)
|
||||
{
|
||||
schema = host = path = query = "";
|
||||
schema = host = path = query = fragment_ = "";
|
||||
url_ = url;
|
||||
|
||||
// Replace the default vhost to a domain like string, or parse failed.
|
||||
|
@ -979,6 +979,7 @@ srs_error_t SrsHttpUri::initialize(string url)
|
|||
|
||||
path = get_uri_field(parsing_url, &hp_u, UF_PATH);
|
||||
query = get_uri_field(parsing_url, &hp_u, UF_QUERY);
|
||||
fragment_ = get_uri_field(parsing_url, &hp_u, UF_FRAGMENT);
|
||||
|
||||
username_ = get_uri_field(parsing_url, &hp_u, UF_USERINFO);
|
||||
size_t pos = username_.find(":");
|
||||
|
@ -1040,6 +1041,11 @@ string SrsHttpUri::get_query_by_key(std::string key)
|
|||
return it->second;
|
||||
}
|
||||
|
||||
std::string SrsHttpUri::get_fragment()
|
||||
{
|
||||
return fragment_;
|
||||
}
|
||||
|
||||
std::string SrsHttpUri::username()
|
||||
{
|
||||
return username_;
|
||||
|
|
|
@ -580,6 +580,7 @@ private:
|
|||
int port;
|
||||
std::string path;
|
||||
std::string query;
|
||||
std::string fragment_;
|
||||
std::string username_;
|
||||
std::string password_;
|
||||
std::map<std::string, std::string> query_values_;
|
||||
|
@ -599,6 +600,7 @@ public:
|
|||
virtual std::string get_path();
|
||||
virtual std::string get_query();
|
||||
virtual std::string get_query_by_key(std::string key);
|
||||
virtual std::string get_fragment();
|
||||
virtual std::string username();
|
||||
virtual std::string password();
|
||||
private:
|
||||
|
|
|
@ -53,8 +53,9 @@ void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vh
|
|||
fullUrl += param.empty() ? "" : (param.at(0) == '?' ? param : "?" + param);
|
||||
|
||||
// First, we covert the FMLE URL to standard URL:
|
||||
// rtmp://ip/app/app2?k=v/stream
|
||||
size_t pos_query = fullUrl.find("?");
|
||||
// rtmp://ip/app/app2?k=v/stream , or:
|
||||
// rtmp://ip/app/app2#k=v/stream
|
||||
size_t pos_query = fullUrl.find_first_of("?#");
|
||||
size_t pos_rslash = fullUrl.rfind("/");
|
||||
if (pos_rslash != string::npos && pos_query != string::npos && pos_query < pos_rslash) {
|
||||
fullUrl = fullUrl.substr(0, pos_query) // rtmp://ip/app/app2
|
||||
|
@ -81,6 +82,7 @@ void srs_discovery_tc_url(string tcUrl, string& schema, string& host, string& vh
|
|||
port = uri.get_port();
|
||||
stream = srs_path_basename(uri.get_path());
|
||||
param = uri.get_query().empty() ? "" : "?" + uri.get_query();
|
||||
param += uri.get_fragment().empty() ? "" : "#" + uri.get_fragment();
|
||||
|
||||
// Parse app without the prefix slash.
|
||||
app = srs_path_dirname(uri.get_path());
|
||||
|
|
|
@ -3560,6 +3560,33 @@ VOID TEST(ProtocolRTMPTest, RTMPRequest)
|
|||
req.update_auth(&req1);
|
||||
EXPECT_TRUE(NULL != req.args);
|
||||
EXPECT_TRUE(req1.args != req.args);
|
||||
|
||||
param = "";
|
||||
req.stream = "livestream";
|
||||
srs_discovery_tc_url("rtmp://std.ossrs.net/live#b=2",
|
||||
req.schema, req.host, req.vhost, req.app, req.stream, req.port, param);
|
||||
EXPECT_STREQ("#b=2", param.c_str());
|
||||
|
||||
param = "";
|
||||
req.stream = "livestream";
|
||||
srs_discovery_tc_url("rtmp://std.ossrs.net/live?a=1#b=2",
|
||||
req.schema, req.host, req.vhost, req.app, req.stream, req.port, param);
|
||||
EXPECT_STREQ("?a=1#b=2", param.c_str());
|
||||
|
||||
param = "";
|
||||
srs_discovery_tc_url("rtmp://std.ossrs.net/live?a=1&c=3#b=2",
|
||||
req.schema, req.host, req.vhost, req.app, req.stream, req.port, param);
|
||||
EXPECT_STREQ("?a=1&c=3#b=2", param.c_str());
|
||||
|
||||
param = "";
|
||||
srs_discovery_tc_url("rtmp://std.ossrs.net/live?a=1&c=3#b=2#d=4",
|
||||
req.schema, req.host, req.vhost, req.app, req.stream, req.port, param);
|
||||
EXPECT_STREQ("?a=1&c=3#b=2#d=4", param.c_str());
|
||||
|
||||
param = "";
|
||||
srs_discovery_tc_url("rtmp://std.ossrs.net/live?a=1#e=5&c=3#b=2#d=4",
|
||||
req.schema, req.host, req.vhost, req.app, req.stream, req.port, param);
|
||||
EXPECT_STREQ("?a=1#e=5&c=3#b=2#d=4", param.c_str());
|
||||
}
|
||||
|
||||
VOID TEST(ProtocolRTMPTest, RTMPHandshakeBytes)
|
||||
|
|
Loading…
Reference in a new issue