如果Header中Location字段含有跟源站一样的地址,则自动修改为当前域名

This commit is contained in:
刘祥超
2022-04-09 20:37:05 +08:00
parent 3f621c5af0
commit 8c4e7129f3
2 changed files with 19 additions and 2 deletions

View File

@@ -142,11 +142,12 @@ func (this *HTTPClientPool) Client(req *HTTPRequest,
rawClient = &http.Client{
Timeout: readTimeout,
Transport: transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
CheckRedirect: func(targetReq *http.Request, via []*http.Request) error {
// 是否跟随
if followRedirects {
var schemeIsSame = true
for _, r := range via {
if r.URL.Scheme != req.URL.Scheme {
if r.URL.Scheme != targetReq.URL.Scheme {
schemeIsSame = false
break
}