From 8d21052c7e3903813a8dac0602ff390f5ca1bb7d Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Mon, 23 Nov 2020 18:27:25 -0500 Subject: [PATCH] Follow 307/308 redirects --- src/unit.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/unit.rs b/src/unit.rs index 166fc12..f39bd3b 100644 --- a/src/unit.rs +++ b/src/unit.rs @@ -263,9 +263,13 @@ pub(crate) fn connect( debug!("redirect {} {} -> {}", resp.status(), url, new_url); return connect(new_unit, use_pooled, redirect_count + 1, empty, true); } + // never change the method for 307/308 + 307 | 308 => { + let empty = Payload::Empty.into_read(); + debug!("redirect {} {} -> {}", resp.status(), url, new_url); + return connect(unit, use_pooled, redirect_count - 1, empty, true); + } _ => (), - // reinstate this with expect-100 - // 307 | 308 | _ => connect(unit, method, use_pooled, redirects - 1, body), }; } }