func setFollowURL(req *http.Request, via []*http.Request) error {
via[0].URL = req.URL
if len(via) >= 10 {
return errors.New("stopped after 10 redirects")
}
return nil
}
Dave Cheney
unread,
May 21, 2018, 4:25:05 AM5/21/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Please keep in mind that the Via header is supplied by he client (the browser) and there is not requirement that it maintains the full chain of custardy of all the urls it has passed though, nor is there any way for Go to know nor enforce that this list remains accurate. Sorry.
Darren Hoo
unread,
May 21, 2018, 5:50:02 AM5/21/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Hi Dave,
I haven't made it clear on the first post, sorry,
I am talking about the behavior of Go's net/http.Client, so there are no browsers involved.
Go's net/http.Client will do redirections transparently for user, but there are no exposed way of get the redirected url.