mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 02:20:25 +08:00
减少一些不必要的访问统计
This commit is contained in:
@@ -478,3 +478,10 @@ func (this *HTTPRequest) WAFMaxRequestSize() int64 {
|
|||||||
func (this *HTTPRequest) DisableAccessLog() {
|
func (this *HTTPRequest) DisableAccessLog() {
|
||||||
this.disableLog = true
|
this.disableLog = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DisableStat 停用统计
|
||||||
|
func (this *HTTPRequest) DisableStat() {
|
||||||
|
if this.web != nil {
|
||||||
|
this.web.StatRef = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,4 +46,7 @@ type Request interface {
|
|||||||
|
|
||||||
// DisableAccessLog 在当前请求中不使用访问日志
|
// DisableAccessLog 在当前请求中不使用访问日志
|
||||||
DisableAccessLog()
|
DisableAccessLog()
|
||||||
|
|
||||||
|
// DisableStat 在当前请求中停用统计
|
||||||
|
DisableStat()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ func (this *TestRequest) DisableAccessLog() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *TestRequest) DisableStat() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (this *TestRequest) ProcessResponseHeaders(headers http.Header, status int) {
|
func (this *TestRequest) ProcessResponseHeaders(headers http.Header, status int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter,
|
|||||||
var rawPath = req.WAFRaw().URL.Path
|
var rawPath = req.WAFRaw().URL.Path
|
||||||
if rawPath == CaptchaPath {
|
if rawPath == CaptchaPath {
|
||||||
req.DisableAccessLog()
|
req.DisableAccessLog()
|
||||||
|
req.DisableStat()
|
||||||
captchaValidator.Run(req, writer, defaultCaptchaType)
|
captchaValidator.Run(req, writer, defaultCaptchaType)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -258,6 +259,7 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter,
|
|||||||
// Get 302验证
|
// Get 302验证
|
||||||
if rawPath == Get302Path {
|
if rawPath == Get302Path {
|
||||||
req.DisableAccessLog()
|
req.DisableAccessLog()
|
||||||
|
req.DisableStat()
|
||||||
get302Validator.Run(req, writer)
|
get302Validator.Run(req, writer)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user