From 26ab24b454fafa5dbb89e6d527a0613e8d66a173 Mon Sep 17 00:00:00 2001 From: fgy Date: Mon, 9 Dec 2024 17:57:50 +0800 Subject: [PATCH] debug: redirect --- pkg/protocol/client/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/protocol/client/client.go b/pkg/protocol/client/client.go index 777f55cdd..072a91a09 100644 --- a/pkg/protocol/client/client.go +++ b/pkg/protocol/client/client.go @@ -43,6 +43,7 @@ package client import ( "context" + "github.com/cloudwego/hertz/pkg/common/hlog" "sync" "time" @@ -220,8 +221,10 @@ func DoRequestFollowRedirects(ctx context.Context, req *protocol.Request, resp * redirectsCount := 0 for { + hlog.Infof("[Redirect] request url: %s", url) req.SetRequestURI(url) req.ParseURI() + hlog.Infof("[Redirect] request url parsed: %s", req.URI().String()) if err = c.Do(ctx, req, resp); err != nil { break @@ -241,7 +244,9 @@ func DoRequestFollowRedirects(ctx context.Context, req *protocol.Request, resp * err = errMissingLocation break } + hlog.Infof("[Redirect] redirect time: %d, origin url: %s, location: %s", redirectsCount, url, location) url = getRedirectURL(url, location) + hlog.Infof("[Redirect] after redirect process url: %s", url) } return statusCode, body, err