Avoid getting stuck in a loop

This prevents a case where we make a request to URL A, which 301s to B which
would then 301 back to A. Alternatively, for less simple schemes, this will
also prevent us from getting stuck in a loop, e.g., it will prevent the
following from causing an endless loop:

```
    A -> B -> C -> D -> E -> F --
    ^                             \
    |                             /
    ---<------------<----------<-
```

Fixes #2231.

I tested this by cloning httpbin and hard coding a permanent redirect loop from `/relative-redirect/1` to `/relative-redirect/2` so that we could trigger this. This pull request fixes it.