pub struct RefererMiddleware {
pub same_origin_only: bool,
pub max_chain_length: usize,
pub include_fragment: bool,
/* private fields */
}Expand description
Built-in middleware that is available without extra feature flags.
Middleware that derives Referer values from request metadata and history.
Fields§
§same_origin_only: boolWhether to use same-origin only referer
max_chain_length: usizeMaximum referer chain length to keep in memory
include_fragment: boolWhether to include fragment in referer URL
Implementations§
Source§impl RefererMiddleware
impl RefererMiddleware
Sourcepub fn new() -> RefererMiddleware
pub fn new() -> RefererMiddleware
Creates a middleware with default settings.
Sourcepub fn same_origin_only(self, same_origin_only: bool) -> RefererMiddleware
pub fn same_origin_only(self, same_origin_only: bool) -> RefererMiddleware
Set whether to use same-origin only referer.
Sourcepub fn max_chain_length(self, max_chain_length: usize) -> RefererMiddleware
pub fn max_chain_length(self, max_chain_length: usize) -> RefererMiddleware
Set the maximum referer chain length to keep in memory.
Sourcepub fn include_fragment(self, include_fragment: bool) -> RefererMiddleware
pub fn include_fragment(self, include_fragment: bool) -> RefererMiddleware
Set whether to include the fragment in the referer URL.
Trait Implementations§
Source§impl Clone for RefererMiddleware
impl Clone for RefererMiddleware
Source§fn clone(&self) -> RefererMiddleware
fn clone(&self) -> RefererMiddleware
Returns a duplicate of the value. Read more
1.0.0 · 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 RefererMiddleware
impl Debug for RefererMiddleware
Source§impl Default for RefererMiddleware
impl Default for RefererMiddleware
Source§fn default() -> RefererMiddleware
fn default() -> RefererMiddleware
Returns the “default value” for a type. Read more
Source§impl<C> Middleware<C> for RefererMiddleware
impl<C> Middleware<C> for RefererMiddleware
Source§fn process_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_client: &'life1 C,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RefererMiddleware: 'async_trait,
fn process_request<'life0, 'life1, 'async_trait>(
&'life0 self,
_client: &'life1 C,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RefererMiddleware: 'async_trait,
Intercepts an outgoing request before the downloader runs. Read more
Source§fn process_response<'life0, 'async_trait>(
&'life0 self,
response: Response,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Response>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RefererMiddleware: 'async_trait,
fn process_response<'life0, 'async_trait>(
&'life0 self,
response: Response,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Response>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RefererMiddleware: 'async_trait,
Intercepts a successful response after download. Read more
Source§fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_request: &'life1 Request,
error: &'life2 SpiderError,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_request: &'life1 Request,
error: &'life2 SpiderError,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Handles downloader errors for a request. Read more
Auto Trait Implementations§
impl Freeze for RefererMiddleware
impl !RefUnwindSafe for RefererMiddleware
impl Send for RefererMiddleware
impl Sync for RefererMiddleware
impl Unpin for RefererMiddleware
impl UnsafeUnpin for RefererMiddleware
impl !UnwindSafe for RefererMiddleware
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