mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复设置allow_ip_range为空后,无法关闭鉴权相关bug
This commit is contained in:
parent
e81efec96e
commit
dfae1aee97
@ -77,12 +77,21 @@ bool HttpFileManager::isIPAllowed(const std::string &ip) {
|
||||
IPRangs ret;
|
||||
auto vec = split(str, ",");
|
||||
for (auto &item : vec) {
|
||||
if (trim(item).empty()) {
|
||||
continue;
|
||||
}
|
||||
auto range = split(item, "-");
|
||||
if (range.size() == 2) {
|
||||
ret.emplace_back(get_ip_uint64(trim(range[0])), get_ip_uint64(trim(range[1])));
|
||||
auto ip_min = get_ip_uint64(trim(range[0]));
|
||||
auto ip_max = get_ip_uint64(trim(range[1]));
|
||||
if (ip_min && ip_max) {
|
||||
ret.emplace_back(ip_min, ip_max);
|
||||
}
|
||||
} else if (range.size() == 1) {
|
||||
auto ip = get_ip_uint64(trim(range[0]));
|
||||
ret.emplace_back(ip, ip);
|
||||
if (ip) {
|
||||
ret.emplace_back(ip, ip);
|
||||
}
|
||||
} else {
|
||||
WarnL << "Invalid ip range: " << item;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user