Added loopback detection using current last rather than contains
This commit is contained in:
parent
d0c5764471
commit
5e7d8841af
@ -43,8 +43,10 @@ fn download_into(
|
||||
// it has a loop back before giving correct url
|
||||
let policy = RedirectPolicy::custom(|attempt| {
|
||||
info!("Redirect Attempt URL: {:?}", attempt.url());
|
||||
if attempt.previous().len() > 10 {
|
||||
if attempt.previous().len() > 5 {
|
||||
attempt.too_many_redirects()
|
||||
} else if attempt.url() == attempt.previous().last().unwrap() {
|
||||
attempt.loop_detected()
|
||||
} else {
|
||||
attempt.follow()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user