Skip to content

Commit

Permalink
debug: redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
FGYFFFF committed Dec 9, 2024
1 parent 7d63572 commit 26ab24b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/protocol/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ package client

import (
"context"
"github.com/cloudwego/hertz/pkg/common/hlog"
"sync"
"time"

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 26ab24b

Please sign in to comment.