From 7f8693d3862d15b087c400af241930209778ff29 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 20 Aug 2023 11:45:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=8D=E5=90=91=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_reverse_proxy.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index c104469..a761829 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -306,7 +306,8 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId if requestErr != nil { // 客户端取消请求,则不提示 - httpErr, ok := requestErr.(*url.Error) + var httpErr *url.Error + ok := errors.As(requestErr, &httpErr) if !ok { if isHTTPOrigin { SharedOriginStateManager.Fail(origin, requestHost, this.reverseProxy, func() { @@ -320,7 +321,7 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId this.write50x(requestErr, http.StatusBadGateway, "Failed to read origin site", "源站读取失败", true) } remotelogs.WarnServer("HTTP_REQUEST_REVERSE_PROXY", this.RawReq.URL.String()+": Request origin server failed: "+requestErr.Error()) - } else if httpErr.Err != context.Canceled { + } else if !errors.Is(httpErr, context.Canceled) { if isHTTPOrigin { SharedOriginStateManager.Fail(origin, requestHost, this.reverseProxy, func() { this.reverseProxy.ResetScheduling() @@ -353,7 +354,7 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId // 是否为客户端方面的错误 var isClientError = false if ok { - if httpErr.Err == context.Canceled { + if errors.Is(httpErr, context.Canceled) { // 如果是服务器端主动关闭,则无需提示 if this.isConnClosed() { this.disableLog = true