title: Too many redirects, but through what route?
body: <p>I've got a simple web scraper/spider based on goquery, which in turn uses net/http. It works great, until I hit a website with too many redirects.</p>
  
  <blockquote>
    <p>Get <a href="http://www.example.com/some/path.html" rel="nofollow">http://www.example.com/some/path.html</a>: stopped after 10 redirects</p>
  </blockquote>
  
  <p>But why? Did it redirect to itself? Did it throw me into some spider jail? I want to know to what url's I got redirected, and in what order. </p>
  
  <p>The function giving the error seems to know this, since it's checking the length of a slice of requests, but I don't really want to edit the net/http package myself.</p>
  
  <p>Here's that function from <a href="http://golang.org/src/pkg/net/http/client.go" rel="nofollow">http://golang.org/src/pkg/net/http/client.go</a></p>
  
  <pre><code>func defaultCheckRedirect(req *Request, via []*Request) error {
      if len(via) &gt;= 10 {
          return errors.New("stopped after 10 redirects")
      }
      return nil
  }
  </code></pre>