Skip to content

Commit

Permalink
Break out each leg of 30x redirect chain
Browse files Browse the repository at this point in the history
Fixes #83
  • Loading branch information
moorereason authored and davecheney committed Sep 28, 2016
1 parent 4211b7d commit ac6eefd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,10 @@ func visit(url *url.URL) {
client := &http.Client{
Transport: tr,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
if !followRedirects {
return http.ErrUseLastResponse
}
if len(via) >= maxRedirects {
if redirectsFollowed >= maxRedirects {
return fmt.Errorf("stopped after %d redirects", maxRedirects)
}
return nil
return http.ErrUseLastResponse
},
}

Expand Down

0 comments on commit ac6eefd

Please sign in to comment.