新增http api与http文件访问ip白名单限制机制,默认禁止公网访问

This commit is contained in:
xia-chu
2023-07-26 16:33:21 +08:00
parent e8f8b48d38
commit 098046cb1d
6 changed files with 77 additions and 2 deletions

View File

@@ -238,6 +238,11 @@ static inline void addHttpListener(){
//该api已被消费
consumed = true;
if (!HttpFileManager::isIPAllowed(sender.get_peer_ip())) {
invoker(403, HttpSession::KeyValue(), "Your ip is not allowed to access the service.");
return;
}
if(api_debug){
auto newInvoker = [invoker, parser](int code, const HttpSession::KeyValue &headerOut, const HttpBody::Ptr &body) {
//body默认为空