mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
在开启on_http_access hook时,访问http文件(或目录)ip白名单机制不生效
on_http_access hook优先级更高,关闭on_http_access hook时才采用ip白名单机制,防止两种鉴权机制间的冲突
This commit is contained in:
parent
dfae1aee97
commit
c1f6517471
@ -625,7 +625,11 @@ void installWebHook() {
|
|||||||
if (!hook_enable || hook_http_access.empty()) {
|
if (!hook_enable || hook_http_access.empty()) {
|
||||||
// 未开启http文件访问鉴权,那么允许访问,但是每次访问都要鉴权;
|
// 未开启http文件访问鉴权,那么允许访问,但是每次访问都要鉴权;
|
||||||
// 因为后续随时都可能开启鉴权(重载配置文件后可能重新开启鉴权)
|
// 因为后续随时都可能开启鉴权(重载配置文件后可能重新开启鉴权)
|
||||||
invoker("", "", 0);
|
if (!HttpFileManager::isIPAllowed(sender.get_peer_ip())) {
|
||||||
|
invoker("Your ip is not allowed to access the service.", "", 0);
|
||||||
|
} else {
|
||||||
|
invoker("", "", 0);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,11 +382,6 @@ static void canAccessPath(Session &sender, const Parser &parser, const MediaInfo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HttpFileManager::isIPAllowed(sender.get_peer_ip())) {
|
|
||||||
callback("Your ip is not allowed to access the service.", nullptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 事件未被拦截,则认为是http下载请求
|
// 事件未被拦截,则认为是http下载请求
|
||||||
bool flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastHttpAccess, parser, path, is_dir, accessPathInvoker, static_cast<SockInfo &>(sender));
|
bool flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastHttpAccess, parser, path, is_dir, accessPathInvoker, static_cast<SockInfo &>(sender));
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user