Only follow 307/308 redirects for methods without a body
This commit is contained in:
committed by
Martin Algesten
parent
8d21052c7e
commit
6bab430d29
@@ -264,7 +264,9 @@ pub(crate) fn connect(
|
||||
return connect(new_unit, use_pooled, redirect_count + 1, empty, true);
|
||||
}
|
||||
// never change the method for 307/308
|
||||
307 | 308 => {
|
||||
// only resend the request if it cannot have a body
|
||||
// NOTE: DELETE is intentionally excluded: https://stackoverflow.com/questions/299628
|
||||
307 | 308 if ["GET", "HEAD", "OPTIONS", "TRACE"].contains(&method.as_str()) => {
|
||||
let empty = Payload::Empty.into_read();
|
||||
debug!("redirect {} {} -> {}", resp.status(), url, new_url);
|
||||
return connect(unit, use_pooled, redirect_count - 1, empty, true);
|
||||
|
||||
Reference in New Issue
Block a user