diff --git a/internal/nodes/http_request_waf.go b/internal/nodes/http_request_waf.go index 2d3eb46..68a4456 100644 --- a/internal/nodes/http_request_waf.go +++ b/internal/nodes/http_request_waf.go @@ -478,3 +478,10 @@ func (this *HTTPRequest) WAFMaxRequestSize() int64 { func (this *HTTPRequest) DisableAccessLog() { this.disableLog = true } + +// DisableStat 停用统计 +func (this *HTTPRequest) DisableStat() { + if this.web != nil { + this.web.StatRef = nil + } +} diff --git a/internal/waf/requests/request.go b/internal/waf/requests/request.go index 03a4787..6c4e53b 100644 --- a/internal/waf/requests/request.go +++ b/internal/waf/requests/request.go @@ -46,4 +46,7 @@ type Request interface { // DisableAccessLog 在当前请求中不使用访问日志 DisableAccessLog() + + // DisableStat 在当前请求中停用统计 + DisableStat() } diff --git a/internal/waf/requests/test_request.go b/internal/waf/requests/test_request.go index 5e76985..4bac305 100644 --- a/internal/waf/requests/test_request.go +++ b/internal/waf/requests/test_request.go @@ -85,6 +85,10 @@ func (this *TestRequest) DisableAccessLog() { } +func (this *TestRequest) DisableStat() { + +} + func (this *TestRequest) ProcessResponseHeaders(headers http.Header, status int) { } diff --git a/internal/waf/waf.go b/internal/waf/waf.go index 97433e4..7a4761f 100644 --- a/internal/waf/waf.go +++ b/internal/waf/waf.go @@ -251,6 +251,7 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter, var rawPath = req.WAFRaw().URL.Path if rawPath == CaptchaPath { req.DisableAccessLog() + req.DisableStat() captchaValidator.Run(req, writer, defaultCaptchaType) return } @@ -258,6 +259,7 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter, // Get 302验证 if rawPath == Get302Path { req.DisableAccessLog() + req.DisableStat() get302Validator.Run(req, writer) return }