pub struct SmartRedirectClient { /* private fields */ }Expand description
A reqwest::Client wrapper that handles HTTP redirects manually,
respecting the Referrer-Policy header and RFC 9110 §15.4 redirect rules.
Implementations§
Source§impl SmartRedirectClient
impl SmartRedirectClient
Sourcepub const fn new(
client: Client,
initial_referer: Option<HeaderValue>,
referrer_policy: Option<ReferrerPolicy>,
origin: Option<HeaderValue>,
authorization: Option<HeaderValue>,
cookie: Option<HeaderValue>,
max_redirects: usize,
) -> Self
pub const fn new( client: Client, initial_referer: Option<HeaderValue>, referrer_policy: Option<ReferrerPolicy>, origin: Option<HeaderValue>, authorization: Option<HeaderValue>, cookie: Option<HeaderValue>, max_redirects: usize, ) -> Self
Build a SmartRedirectClient from an already-constructed reqwest::Client.
client— the underlying client. Must be built withredirect(reqwest::redirect::Policy::none()), otherwise the manual redirect logic here conflicts with reqwest’s own auto-follow.initial_referer— theReferersent on the first request.referrer_policy— the policy applied when noReferrer-Policyheader is present on a response; per-hop headers override it.origin/authorization/cookie— resource-specific headers injected only on the first hop and stripped on redirect (RFC 9110 §15.4).max_redirects— the maximum number of redirects to follow before failing with aStatusCodeerror.
Trait Implementations§
Source§impl Clone for SmartRedirectClient
impl Clone for SmartRedirectClient
Source§impl Debug for SmartRedirectClient
impl Debug for SmartRedirectClient
Source§impl HttpClient for SmartRedirectClient
impl HttpClient for SmartRedirectClient
Source§type RequestBuilder = ManualRedirectRequestBuilder
type RequestBuilder = ManualRedirectRequestBuilder
The request builder this client produces.
Source§fn get(&self, url: Url, range: Option<ProgressEntry>) -> Self::RequestBuilder
fn get(&self, url: Url, range: Option<ProgressEntry>) -> Self::RequestBuilder
Start a GET request, optionally restricted to
range.Auto Trait Implementations§
impl !Freeze for SmartRedirectClient
impl !RefUnwindSafe for SmartRedirectClient
impl !UnwindSafe for SmartRedirectClient
impl Send for SmartRedirectClient
impl Sync for SmartRedirectClient
impl Unpin for SmartRedirectClient
impl UnsafeUnpin for SmartRedirectClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<Client, BorrowClient> Prefetch<Client> for BorrowClient
impl<Client, BorrowClient> Prefetch<Client> for BorrowClient
Source§async fn prefetch(
&self,
url: Url,
) -> Result<(UrlInfo, <<Client as HttpClient>::RequestBuilder as HttpRequestBuilder>::Response), (<<Client as HttpClient>::RequestBuilder as HttpRequestBuilder>::RequestError, Option<Duration>)>
async fn prefetch( &self, url: Url, ) -> Result<(UrlInfo, <<Client as HttpClient>::RequestBuilder as HttpRequestBuilder>::Response), (<<Client as HttpClient>::RequestBuilder as HttpRequestBuilder>::RequestError, Option<Duration>)>
Fetch the resource metadata and the initial response for
url.