From 86decd04cb4766ede8729e5407c42db4bdf3c623 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Thu, 9 Mar 2023 15:15:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0CC=E9=98=B2=E6=8A=A4=EF=BC=88?= =?UTF-8?q?=E5=BC=80=E6=BA=90=E7=94=A8=E6=88=B7=E9=9C=80=E8=A6=81=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E5=AE=9E=E7=8E=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 17 +++++++++++++++++ internal/nodes/http_request_cc.go | 8 ++++++++ 2 files changed, 25 insertions(+) create mode 100644 internal/nodes/http_request_cc.go diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 934bc8a..21b3347 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -221,6 +221,18 @@ func (this *HTTPRequest) Do() { } } + // CC + if !isHealthCheck { + if this.web.CC != nil { + if this.web.CC.IsOn { + if this.doCC() { + this.doEnd() + return + } + } + } + } + // WAF if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn { if this.doWAFRequest() { @@ -572,6 +584,11 @@ func (this *HTTPRequest) configureWeb(web *serverconfigs.HTTPWebConfig, isTop bo this.web.UAM = web.UAM } + // CC + if web.CC != nil && (web.CC.IsPrior || isTop) { + this.web.CC = web.CC + } + // 重写规则 if len(web.RewriteRefs) > 0 { for index, ref := range web.RewriteRefs { diff --git a/internal/nodes/http_request_cc.go b/internal/nodes/http_request_cc.go new file mode 100644 index 0000000..b803e19 --- /dev/null +++ b/internal/nodes/http_request_cc.go @@ -0,0 +1,8 @@ +// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn . +//go:build !plus + +package nodes + +func (this *HTTPRequest) doCC() (block bool) { + return +}