protected override void OnConnectFeelExistProblem(RunModuleEvent arg, httpEntity.ReqCache reqCache) { // 忽略local ip address //if (reqCache.IP == "127.0.0.1" || reqCache.IP == "::1") //{ // arg.Handled = false; //} base.OnConnectFeelExistProblem(arg, reqCache); }
/// <summary> /// 定义一个标识当 http_service_module 模块检测到某个请求客户端可能存在问题时执行的方法 /// </summary> /// <param name="arg">RunModuleEvent参数,可以通过修改Handled来改变是否需要执行系统自定义的校验</param> /// <param name="reqCache">可能存在问题的ReqCache对象,此对象保存在Memcached中</param> protected virtual void OnConnectFeelExistProblem(RunModuleEvent arg, ReqCache reqCache) { arg.Handled = true; }
/// <summary> /// 定义一个标识当 http_service_module 模块开始校验客户端请求的时的方法 /// 注意:如果请求验证通过,需要返回True。如果请求验证失败,返回false,程序将直接调用EndRequest()方法结束本次请求处理 /// </summary> /// <param name="arg">RunModuleEvent参数,可以通过修改Handled来改变是否需要执行系统自定义的校验</param> /// <param name="reqCache">输出参数(当前请求的reqCache对象)</param> protected virtual bool OnBeginValidConnect(RunModuleEvent arg, ref ReqCache reqCache) { // 验证IP是否可访问,会自动增加挂起次数,单位时间访问次数 if (!ReqCacheDbUtility.IsValid(CurrentHTTPApp, out reqCache)) { arg.Handled = false; // 如果请求感觉不合法,调用OnConnectFeelExistProblem函数 OnConnectFeelExistProblem(arg, reqCache); return !(arg.Handled); } return true; }