mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-13 23:10:25 +08:00
在GET302和CAPTCHA验证中不记录特殊URL的访问日志
This commit is contained in:
@@ -421,3 +421,8 @@ func (this *HTTPRequest) WAFFingerprint() []byte {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DisableAccessLog 在当前请求中不使用访问日志
|
||||||
|
func (this *HTTPRequest) DisableAccessLog() {
|
||||||
|
this.disableLog = true
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,4 +37,7 @@ type Request interface {
|
|||||||
|
|
||||||
// Format 格式化变量
|
// Format 格式化变量
|
||||||
Format(string) string
|
Format(string) string
|
||||||
|
|
||||||
|
// DisableAccessLog 在当前请求中不使用访问日志
|
||||||
|
DisableAccessLog()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,3 +76,11 @@ func (this *TestRequest) Format(s string) string {
|
|||||||
func (this *TestRequest) WAFOnAction(action interface{}) bool {
|
func (this *TestRequest) WAFOnAction(action interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *TestRequest) WAFFingerprint() []byte {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TestRequest) DisableAccessLog() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -250,12 +250,14 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter)
|
|||||||
// validate captcha
|
// validate captcha
|
||||||
var rawPath = req.WAFRaw().URL.Path
|
var rawPath = req.WAFRaw().URL.Path
|
||||||
if rawPath == CaptchaPath {
|
if rawPath == CaptchaPath {
|
||||||
|
req.DisableAccessLog()
|
||||||
captchaValidator.Run(req, writer)
|
captchaValidator.Run(req, writer)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get 302验证
|
// Get 302验证
|
||||||
if rawPath == Get302Path {
|
if rawPath == Get302Path {
|
||||||
|
req.DisableAccessLog()
|
||||||
get302Validator.Run(req, writer)
|
get302Validator.Run(req, writer)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user