完善ipv6支持

This commit is contained in:
ziyue
2022-05-08 17:06:10 +08:00
parent a44334acaf
commit d037acbf62
4 changed files with 6 additions and 12 deletions

View File

@@ -506,15 +506,9 @@ void MediaInfo::parse(const string &url_in){
}
auto split_vec = split(url.substr(schema_pos + 3), "/");
if (split_vec.size() > 0) {
auto vhost = split_vec[0];
auto pos = vhost.find(":");
if (pos != string::npos) {
_host = _vhost = vhost.substr(0, pos);
_port = vhost.substr(pos + 1);
} else {
_host = _vhost = vhost;
}
if (_vhost == "localhost" || isIP(_vhost.data())) {
splitUrl(split_vec[0], _host, _port);
_vhost = _host;
if (_vhost == "localhost" || isIP(_vhost.data())) {
//如果访问的是localhost或ip那么则为默认虚拟主机
_vhost = DEFAULT_VHOST;
}