pub struct FollowRedirects { /* private fields */ }Available on crate feature
client only.Expand description
A ClientHandler that automatically follows HTTP redirects.
See the module-level documentation for behavior and configuration.
Implementations§
Source§impl FollowRedirects
impl FollowRedirects
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new FollowRedirects with default settings: max 10 redirects,
HTTPS-to-HTTP downgrade blocked, all origins allowed.
Sourcepub fn with_max_redirects(self, max: u32) -> Self
pub fn with_max_redirects(self, max: u32) -> Self
Set the maximum number of redirects to follow before erroring with
RedirectError::TooMany.
Sourcepub fn with_allow_downgrade(self, allow: bool) -> Self
pub fn with_allow_downgrade(self, allow: bool) -> Self
Allow or block redirects from https:// to http://. Default is blocked.
Sourcepub fn with_allowed_origins<I: IntoIterator<Item = Url>>(
self,
origins: I,
) -> Self
pub fn with_allowed_origins<I: IntoIterator<Item = Url>>( self, origins: I, ) -> Self
Restrict redirects to the given allowlist of origins. Each Url’s
origin (scheme + host + port) is added to the
allowlist; the path/query/fragment of the input URLs is ignored.
When set, redirects to any other origin error with RedirectError::OriginNotAllowed.
When unset (the default), all origins are permitted.
Trait Implementations§
Source§impl ClientHandler for FollowRedirects
impl ClientHandler for FollowRedirects
Source§async fn run(&self, conn: &mut Conn) -> Result<()>
async fn run(&self, conn: &mut Conn) -> Result<()>
Forward-pass hook, called before the network round-trip in declared order. Read more
Source§impl Clone for FollowRedirects
impl Clone for FollowRedirects
Source§fn clone(&self) -> FollowRedirects
fn clone(&self) -> FollowRedirects
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FollowRedirects
impl Debug for FollowRedirects
Auto Trait Implementations§
impl Freeze for FollowRedirects
impl RefUnwindSafe for FollowRedirects
impl Send for FollowRedirects
impl Sync for FollowRedirects
impl Unpin for FollowRedirects
impl UnsafeUnpin for FollowRedirects
impl UnwindSafe for FollowRedirects
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more