From dac89cd3a837f55cb67f0598aca11354245582d1 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 16 Jan 2024 12:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D5=E7=A7=92=E7=9B=BE=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=8F=AF=E8=83=BD=E5=8F=97WAF=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=B7=A5=E4=BD=9C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 28 ++++++++++++++++++---------- internal/nodes/http_request_uam.go | 10 ++++++++-- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index f4374b3..cd4369d 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -210,6 +210,22 @@ func (this *HTTPRequest) Do() { } } + // UAM + var uamIsCalled = false + if !this.isHealthCheck { + if this.web.UAM == nil && this.ReqServer.UAM != nil && this.ReqServer.UAM.IsOn { + this.web.UAM = this.ReqServer.UAM + } + + if this.web.UAM != nil && this.web.UAM.IsOn && this.isUAMRequest() { + uamIsCalled = true + if this.doUAM() { + this.doEnd() + return + } + } + } + // WAF if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn { if this.doWAFRequest() { @@ -219,16 +235,8 @@ func (this *HTTPRequest) Do() { } // UAM - if !this.isHealthCheck { - if this.web.UAM != nil { - if this.web.UAM.IsOn { - if this.doUAM() { - this.doEnd() - return - } - } - } else if this.ReqServer.UAM != nil && this.ReqServer.UAM.IsOn { - this.web.UAM = this.ReqServer.UAM + if !this.isHealthCheck && !uamIsCalled { + if this.web.UAM != nil && this.web.UAM.IsOn { if this.doUAM() { this.doEnd() return diff --git a/internal/nodes/http_request_uam.go b/internal/nodes/http_request_uam.go index b635034..4dd682e 100644 --- a/internal/nodes/http_request_uam.go +++ b/internal/nodes/http_request_uam.go @@ -4,7 +4,13 @@ package nodes -// UAM -func (this *HTTPRequest) doUAM() (block bool) { +func (this *HTTPRequest) isUAMRequest() bool { + // stub + return false +} + +// UAM +func (this *HTTPRequest) doUAM() (block bool) { + // stub return false }