mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
完善http直播url解析规则pr:#1467
This commit is contained in:
parent
81c0635bf2
commit
2d88115b3f
@ -185,20 +185,21 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffi
|
|||||||
// unsupported schema
|
// unsupported schema
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
int prefix_size = url_suffix.size();
|
||||||
int prefix_len = url_suffix.length();
|
if (url.size() < prefix_size || strcasecmp(url.data() + (url.size() - prefix_size), url_suffix.data())) {
|
||||||
if(url.length() < prefix_len || strcasecmp(url.substr(url.length() - prefix_len).c_str(), url_suffix.c_str())) {
|
|
||||||
//未找到后缀
|
//未找到后缀
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// url去除特殊后缀
|
// url去除特殊后缀
|
||||||
url = url.substr(0, url.size() - prefix_len);
|
url.resize(url.size() - prefix_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
//带参数的url
|
//带参数的url
|
||||||
if(!_parser.Params().empty())
|
if (!_parser.Params().empty()) {
|
||||||
url += "?" + _parser.Params();
|
url += "?";
|
||||||
|
url += _parser.Params();
|
||||||
|
}
|
||||||
|
|
||||||
//解析带上协议+参数完整的url
|
//解析带上协议+参数完整的url
|
||||||
_mediaInfo.parse(schema + "://" + _parser["Host"] + url);
|
_mediaInfo.parse(schema + "://" + _parser["Host"] + url);
|
||||||
@ -235,8 +236,7 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffi
|
|||||||
if (!src) {
|
if (!src) {
|
||||||
//未找到该流
|
//未找到该流
|
||||||
strong_self->sendNotFound(close_flag);
|
strong_self->sendNotFound(close_flag);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
strong_self->_is_live_stream = true;
|
strong_self->_is_live_stream = true;
|
||||||
//触发回调
|
//触发回调
|
||||||
cb(src);
|
cb(src);
|
||||||
|
Loading…
Reference in New Issue
Block a user