From 8794bf567612ceac140eac90ff03bf1a5b771eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 18 Apr 2024 08:29:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=BA=90=E8=B7=9F=E9=9A=8F=E9=99=90?= =?UTF-8?q?=E5=88=B6=E5=8D=95=E6=AC=A1=E8=AF=B7=E6=B1=82=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=AC=A1=E6=95=B0=E4=B8=BA8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_client_pool.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/nodes/http_client_pool.go b/internal/nodes/http_client_pool.go index 5bd3149..b64c7e9 100644 --- a/internal/nodes/http_client_pool.go +++ b/internal/nodes/http_client_pool.go @@ -24,6 +24,7 @@ import ( var SharedHTTPClientPool = NewHTTPClientPool() const httpClientProxyProtocolTag = "@ProxyProtocol@" +const maxHTTPRedirects = 8 // HTTPClientPool 客户端池 type HTTPClientPool struct { @@ -212,8 +213,8 @@ func (this *HTTPClientPool) Client(req *HTTPRequest, Timeout: readTimeout, Transport: transport, CheckRedirect: func(targetReq *http.Request, via []*http.Request) error { - // 是否跟随 - if followRedirects { + // follow redirects + if followRedirects && len(via) <= maxHTTPRedirects { return nil }