From 928bbae0c8dd30623d9a9b1074942d39b4fae24d Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 7 Dec 2021 10:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=94=AF=E6=8C=81=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=96=B9=E6=B3=95=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 1 + internal/nodes/http_request_cache.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 30ffeee..1bd6896 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -110,6 +110,7 @@ func (this *HTTPRequest) init() { // 缓存相关初始化 "cache.status": "BYPASS", "cache.age": "0", + "cache.key": "", "cache.policy.name": "", "cache.policy.id": "0", "cache.policy.type": "", diff --git a/internal/nodes/http_request_cache.go b/internal/nodes/http_request_cache.go index 03e8c26..7c2c443 100644 --- a/internal/nodes/http_request_cache.go +++ b/internal/nodes/http_request_cache.go @@ -81,6 +81,12 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) { } } + // 校验请求 + if !this.cacheRef.MatchRequest(this.RawReq) { + this.cacheRef = nil + return + } + // 相关变量 this.varMapping["cache.policy.name"] = cachePolicy.Name this.varMapping["cache.policy.id"] = strconv.FormatInt(cachePolicy.Id, 10)