mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-16 07:46:36 +08:00
修复WAF OnAction在并发时无法准确调用请求动作的Bug
This commit is contained in:
@@ -190,14 +190,6 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir
|
||||
return
|
||||
}
|
||||
|
||||
w.OnAction(func(action waf.ActionInterface) (goNext bool) {
|
||||
switch action.Code() {
|
||||
case waf.ActionTag:
|
||||
this.tags = action.(*waf.TagAction).Tags
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
goNext, ruleGroup, ruleSet, err := w.MatchRequest(this, this.writer)
|
||||
if err != nil {
|
||||
remotelogs.Error("HTTP_REQUEST_WAF", this.rawURI+": "+err.Error())
|
||||
@@ -254,14 +246,6 @@ func (this *HTTPRequest) checkWAFResponse(firewallPolicy *firewallconfigs.HTTPFi
|
||||
return
|
||||
}
|
||||
|
||||
w.OnAction(func(action waf.ActionInterface) (goNext bool) {
|
||||
switch action.Code() {
|
||||
case waf.ActionTag:
|
||||
this.tags = action.(*waf.TagAction).Tags
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
goNext, ruleGroup, ruleSet, err := w.MatchResponse(this, resp, this.writer)
|
||||
if err != nil {
|
||||
remotelogs.Error("HTTP_REQUEST_WAF", this.rawURI+": "+err.Error())
|
||||
@@ -344,3 +328,20 @@ func (this *HTTPRequest) WAFClose() {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *HTTPRequest) WAFOnAction(action interface{}) (goNext bool) {
|
||||
if action == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
instance, ok := action.(waf.ActionInterface)
|
||||
if !ok {
|
||||
return true
|
||||
}
|
||||
|
||||
switch instance.Code() {
|
||||
case waf.ActionTag:
|
||||
this.tags = append(this.tags, action.(*waf.TagAction).Tags...)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user