pub struct FetchPolicy {
pub allowed_domains: Option<Vec<DomainPattern>>,
pub blocked_domains: Vec<DomainPattern>,
pub deny_private_ips: bool,
pub allowed_methods: Vec<String>,
pub allowed_schemes: Vec<String>,
pub max_request_body_bytes: usize,
pub max_response_body_bytes: usize,
pub connect_timeout_ms: u64,
pub request_timeout_ms: u64,
pub max_redirects: u8,
pub max_concurrent_requests: usize,
pub max_requests_per_minute: u32,
}Expand description
Controls every aspect of what the safe HTTP client is allowed to do.
Fields§
§allowed_domains: Option<Vec<DomainPattern>>If Some, only these domains may be fetched. If None, all public domains are allowed.
blocked_domains: Vec<DomainPattern>Domains that are always rejected (checked before allowed_domains).
deny_private_ips: boolBlock requests that resolve to private/internal IPs (default: true).
allowed_methods: Vec<String>Allowed HTTP methods (default: common methods).
allowed_schemes: Vec<String>Allowed URL schemes (default: [“https”, “http”]).
max_request_body_bytes: usizeMax request body size in bytes (default: 10 MB).
max_response_body_bytes: usizeMax response body size in bytes (default: 50 MB).
connect_timeout_ms: u64TCP connect timeout in milliseconds (default: 10 000).
request_timeout_ms: u64Overall request timeout in milliseconds (default: 30 000).
max_redirects: u8Maximum number of redirects to follow (default: 10).
max_concurrent_requests: usizeMaximum number of concurrent in-flight requests (default: 50).
max_requests_per_minute: u32Maximum requests per minute globally (default: 500).
Implementations§
Source§impl FetchPolicy
impl FetchPolicy
Sourcepub fn check_domain(&self, domain: &str) -> Result<(), FetchError>
pub fn check_domain(&self, domain: &str) -> Result<(), FetchError>
Check domain against blocked list, then allowed list.
pub fn check_scheme(&self, scheme: &str) -> Result<(), FetchError>
pub fn check_method(&self, method: &str) -> Result<(), FetchError>
Trait Implementations§
Source§impl Clone for FetchPolicy
impl Clone for FetchPolicy
Source§fn clone(&self) -> FetchPolicy
fn clone(&self) -> FetchPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FetchPolicy
impl Debug for FetchPolicy
Source§impl Default for FetchPolicy
impl Default for FetchPolicy
Source§fn default() -> FetchPolicy
fn default() -> FetchPolicy
Source§impl<'de> Deserialize<'de> for FetchPolicy
impl<'de> Deserialize<'de> for FetchPolicy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FetchPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FetchPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for FetchPolicy
impl Serialize for FetchPolicy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for FetchPolicy
impl RefUnwindSafe for FetchPolicy
impl Send for FetchPolicy
impl Sync for FetchPolicy
impl Unpin for FetchPolicy
impl UnwindSafe for FetchPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more