mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine code for api, add clients and parse_rest_id
This commit is contained in:
parent
ab4620870d
commit
a7589b9ad3
7 changed files with 93 additions and 10 deletions
|
@ -654,6 +654,7 @@ string SrsHttpMessage::uri()
|
|||
|
||||
uri += host();
|
||||
uri += path();
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
@ -677,6 +678,21 @@ string SrsHttpMessage::ext()
|
|||
return _ext;
|
||||
}
|
||||
|
||||
int SrsHttpMessage::parse_rest_id(string pattern)
|
||||
{
|
||||
string p = _uri->get_path();
|
||||
if (p.length() <= pattern.length()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
string id = p.substr((int)pattern.length());
|
||||
if (!id.empty()) {
|
||||
return ::atoi(id.c_str());
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SrsHttpMessage::body_read_all(string& body)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue