From f43ad5a9d59e30a193b62b0fa4232748d27aa739 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 12 Sep 2023 10:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=9C=A8=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5=E6=97=B6=E4=B8=8D=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=8C=87=E6=A0=87=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 650e191..3130ac3 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -38,15 +38,16 @@ type HTTPRequest struct { requestId string // 外部参数 - RawReq *http.Request - RawWriter http.ResponseWriter - ReqServer *serverconfigs.ServerConfig - ReqHost string // 请求的Host - ServerName string // 实际匹配到的Host - ServerAddr string // 实际启动的服务器监听地址 - IsHTTP bool - IsHTTPS bool - IsHTTP3 bool + RawReq *http.Request + RawWriter http.ResponseWriter + ReqServer *serverconfigs.ServerConfig + ReqHost string // 请求的Host + ServerName string // 实际匹配到的Host + ServerAddr string // 实际启动的服务器监听地址 + IsHTTP bool + IsHTTPS bool + IsHTTP3 bool + isHealthCheck bool // 共享参数 nodeConfig *nodeconfigs.NodeConfig @@ -168,10 +169,9 @@ func (this *HTTPRequest) Do() { } // 处理健康检查 - var isHealthCheck = false var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName) if len(healthCheckKey) > 0 { - if this.doHealthCheck(healthCheckKey, &isHealthCheck) { + if this.doHealthCheck(healthCheckKey, &this.isHealthCheck) { this.doEnd() return } @@ -205,7 +205,7 @@ func (this *HTTPRequest) Do() { } // UAM - if !isHealthCheck { + if !this.isHealthCheck { if this.web.UAM != nil { if this.web.UAM.IsOn { if this.doUAM() { @@ -223,7 +223,7 @@ func (this *HTTPRequest) Do() { } // CC - if !isHealthCheck { + if !this.isHealthCheck { if this.web.CC != nil { if this.web.CC.IsOn { if this.doCC() { @@ -388,7 +388,7 @@ func (this *HTTPRequest) doEnd() { // 流量统计 // TODO 增加是否开启开关 - if this.ReqServer != nil && this.ReqServer.Id > 0 { + if this.ReqServer != nil && this.ReqServer.Id > 0 && !this.isHealthCheck /** 健康检查时不统计 **/ { var totalBytes int64 = 0 var requestConn = this.RawReq.Context().Value(HTTPConnContextKey)