回源跟随限制单次请求最大跳转次数为8

This commit is contained in:
GoEdgeLab
2024-04-18 08:29:52 +08:00
parent ddcc56b288
commit b885516254

View File

@@ -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
}