From f2cd4e2b02dc64eb353ffb6be951deeb8176ab30 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 14 Jul 2023 16:03:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=B0=81=E7=A6=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BB=B6=E6=97=B6=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_waf.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/nodes/http_request_waf.go b/internal/nodes/http_request_waf.go index fa57929..11f1b54 100644 --- a/internal/nodes/http_request_waf.go +++ b/internal/nodes/http_request_waf.go @@ -12,6 +12,7 @@ import ( "github.com/iwind/TeaGo/types" "io" "net/http" + "time" ) // 调用WAF @@ -182,8 +183,8 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir this.writeCode(http.StatusForbidden, "The region has been denied.", "当前区域禁止访问") } - this.writer.Flush() - this.writer.Close() + // 延时返回,避免攻击 + time.Sleep(1 * time.Second) // 停止日志 if !logDenying { @@ -209,8 +210,9 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir } else { this.writeCode(http.StatusForbidden, "The region has been denied.", "当前区域禁止访问") } - this.writer.Flush() - this.writer.Close() + + // 延时返回,避免攻击 + time.Sleep(1 * time.Second) // 停止日志 if !logDenying {