mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
API: Parse fragment of URI. v5.0.106 (#3295)
* parse fragment of uri * adapt FMLE URL: 'rtmp://ip/app/app2#k=v/stream', then add more test case Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
parent
0e550d496b
commit
c5a0c5947f
6 changed files with 42 additions and 4 deletions
|
@ -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_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue