mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-18 19:50:25 +08:00
回源跟随限制单次请求最大跳转次数为8
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
|||||||
var SharedHTTPClientPool = NewHTTPClientPool()
|
var SharedHTTPClientPool = NewHTTPClientPool()
|
||||||
|
|
||||||
const httpClientProxyProtocolTag = "@ProxyProtocol@"
|
const httpClientProxyProtocolTag = "@ProxyProtocol@"
|
||||||
|
const maxHTTPRedirects = 8
|
||||||
|
|
||||||
// HTTPClientPool 客户端池
|
// HTTPClientPool 客户端池
|
||||||
type HTTPClientPool struct {
|
type HTTPClientPool struct {
|
||||||
@@ -212,8 +213,8 @@ func (this *HTTPClientPool) Client(req *HTTPRequest,
|
|||||||
Timeout: readTimeout,
|
Timeout: readTimeout,
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
CheckRedirect: func(targetReq *http.Request, via []*http.Request) error {
|
CheckRedirect: func(targetReq *http.Request, via []*http.Request) error {
|
||||||
// 是否跟随
|
// follow redirects
|
||||||
if followRedirects {
|
if followRedirects && len(via) <= maxHTTPRedirects {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user