New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix redirect limited(0) should not follow redirects #1645
Conversation
@@ -128,7 +128,7 @@ impl Policy { | |||
match self.inner { | |||
PolicyKind::Custom(ref custom) => custom(attempt), | |||
PolicyKind::Limit(max) => { | |||
if attempt.previous.len() == max { | |||
if attempt.previous.len() >= max { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this still be without the change? The previous length should be 0, and max is 0... Is there a time that isn't true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reqwest/src/async_impl/client.rs
Line 1975 in a0a7db0
self.as_mut().urls().push(url); |
Yes, it isn't true because the url is pushed to the
previous
before calling check
, so the length always has at least 1 item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, of course! Want to readd the test but with a URL in the previous Vec as well, so we catch this if it ever changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for catching this!
Fixed #1639