pub struct RequestConfig {
pub buffer_size: usize,
pub max_path_size: usize,
pub max_header_count: usize,
pub max_header_key_size: usize,
pub max_header_value_size: usize,
pub max_body_size: usize,
pub read_timeout_ms: u64,
}Expand description
Configuration for HTTP request parsing security limits.
This struct defines various limits and constraints to prevent
denial-of-service attacks and other security vulnerabilities
when parsing HTTP requests.
Since all fields implement Copy, this struct is lightweight
and can be easily cloned and shared.
Fields§
§buffer_size: usizeBuffer size for reading operations.
max_path_size: usizeMaximum size for URL path in bytes.
max_header_count: usizeMaximum number of headers allowed in a request.
max_header_key_size: usizeMaximum size for a header key in bytes.
max_header_value_size: usizeMaximum size for a header value in bytes.
max_body_size: usizeMaximum size for request body in bytes.
read_timeout_ms: u64Timeout for reading data in milliseconds.
Implementations§
Source§impl RequestConfig
impl RequestConfig
Sourcepub fn from_json<C>(json: C) -> Result<RequestConfig, Error>
pub fn from_json<C>(json: C) -> Result<RequestConfig, Error>
Sourcepub fn low_security() -> Self
pub fn low_security() -> Self
Creates a new RequestConfig with low-security settings.
This constructor initializes the configuration with less restrictive limits for environments where higher limits are needed.
§Returns
Self- A newRequestConfiginstance with low-security settings.
Sourcepub fn high_security() -> Self
pub fn high_security() -> Self
Creates a new RequestConfig with high-security settings.
This constructor initializes the configuration with more restrictive limits to provide maximum protection against various attacks in high-risk environments.
§Returns
Self- A newRequestConfiginstance with high-security settings.
Source§impl RequestConfig
impl RequestConfig
pub fn get_buffer_size(&self) -> usize
pub fn set_buffer_size(&mut self, val: usize) -> &mut Self
pub fn get_mut_buffer_size(&mut self) -> &mut usize
pub fn get_max_path_size(&self) -> usize
pub fn set_max_path_size(&mut self, val: usize) -> &mut Self
pub fn get_mut_max_path_size(&mut self) -> &mut usize
pub fn get_max_header_count(&self) -> usize
pub fn set_max_header_count(&mut self, val: usize) -> &mut Self
pub fn get_mut_max_header_count(&mut self) -> &mut usize
pub fn get_max_header_key_size(&self) -> usize
pub fn set_max_header_key_size(&mut self, val: usize) -> &mut Self
pub fn get_mut_max_header_key_size(&mut self) -> &mut usize
pub fn get_max_header_value_size(&self) -> usize
pub fn set_max_header_value_size(&mut self, val: usize) -> &mut Self
pub fn get_mut_max_header_value_size(&mut self) -> &mut usize
pub fn get_max_body_size(&self) -> usize
pub fn set_max_body_size(&mut self, val: usize) -> &mut Self
pub fn get_mut_max_body_size(&mut self) -> &mut usize
pub fn get_read_timeout_ms(&self) -> u64
pub fn set_read_timeout_ms(&mut self, val: u64) -> &mut Self
pub fn get_mut_read_timeout_ms(&mut self) -> &mut u64
Trait Implementations§
Source§impl Clone for RequestConfig
impl Clone for RequestConfig
Source§fn clone(&self) -> RequestConfig
fn clone(&self) -> RequestConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RequestConfig
impl Debug for RequestConfig
Source§impl Default for RequestConfig
Implementation of Default trait for RequestConfig.
impl Default for RequestConfig
Implementation of Default trait for RequestConfig.
Source§impl<'de> Deserialize<'de> for RequestConfig
impl<'de> Deserialize<'de> for RequestConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RequestConfig
impl Display for RequestConfig
Source§impl PartialEq for RequestConfig
impl PartialEq for RequestConfig
Source§fn eq(&self, other: &RequestConfig) -> bool
fn eq(&self, other: &RequestConfig) -> bool
self and other values to be equal, and is used by ==.