From f925d861076f5db24b859364ef3ca17b5a9acf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Tue, 29 Mar 2022 21:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E4=B8=9A=E7=89=88=E5=A2=9E=E5=8A=A0UA?= =?UTF-8?q?M=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 11 ++++++++++- internal/nodes/http_request_health_check.go | 3 ++- internal/nodes/http_request_uam.go | 10 ++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 internal/nodes/http_request_uam.go diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index db5122c..6e7acfb 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -241,9 +241,18 @@ func (this *HTTPRequest) doBegin() { } // 处理健康检查 + var isHealthCheck = false var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName) if len(healthCheckKey) > 0 { - if this.doHealthCheck(healthCheckKey) { + if this.doHealthCheck(healthCheckKey, &isHealthCheck) { + return + } + } + + // UAM + if !isHealthCheck && this.ReqServer.UAM != nil && this.ReqServer.UAM.IsOn { + if this.doUAM() { + this.doEnd() return } } diff --git a/internal/nodes/http_request_health_check.go b/internal/nodes/http_request_health_check.go index 1041351..da30dc6 100644 --- a/internal/nodes/http_request_health_check.go +++ b/internal/nodes/http_request_health_check.go @@ -9,7 +9,7 @@ import ( ) // 健康检查 -func (this *HTTPRequest) doHealthCheck(key string) (stop bool) { +func (this *HTTPRequest) doHealthCheck(key string, isHealthCheck *bool) (stop bool) { this.tags = append(this.tags, "healthCheck") this.RawReq.Header.Del(serverconfigs.HealthCheckHeaderName) @@ -19,6 +19,7 @@ func (this *HTTPRequest) doHealthCheck(key string) (stop bool) { remotelogs.Error("HTTP_REQUEST_HEALTH_CHECK", "decode key failed: "+err.Error()) return } + *isHealthCheck = true if data.GetBool("onlyBasicRequest") { return true diff --git a/internal/nodes/http_request_uam.go b/internal/nodes/http_request_uam.go new file mode 100644 index 0000000..b635034 --- /dev/null +++ b/internal/nodes/http_request_uam.go @@ -0,0 +1,10 @@ +// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. +//go:build !plus +// +build !plus + +package nodes + +// UAM +func (this *HTTPRequest) doUAM() (block bool) { + return false +}