use fieldwork::Fieldwork;
#[derive(Clone, Copy, Debug, Fieldwork)]
#[fieldwork(get, get_mut, set, with, without)]
#[allow(clippy::struct_excessive_bools)]
pub struct HttpConfig {
pub(crate) head_max_len: usize,
pub(crate) received_body_max_len: u64,
#[cfg(not(feature = "parse"))]
#[field = false] pub(crate) max_headers: usize,
pub(crate) response_buffer_len: usize,
pub(crate) response_buffer_max_len: usize,
pub(crate) request_buffer_initial_len: usize,
pub(crate) response_header_initial_capacity: usize,
pub(crate) copy_loops_per_yield: usize,
pub(crate) received_body_initial_len: usize,
pub(crate) received_body_max_preallocate: usize,
pub(crate) max_header_list_size: u64,
pub(crate) dynamic_table_capacity: usize,
pub(crate) h3_blocked_streams: usize,
pub(crate) recent_pairs_size: usize,
pub(crate) h2_initial_stream_window_size: u32,
pub(crate) h2_max_stream_recv_window_size: u32,
pub(crate) h2_initial_connection_window_size: u32,
pub(crate) h2_max_concurrent_streams: u32,
pub(crate) h2_max_frame_size: u32,
pub(crate) h3_datagrams_enabled: bool,
pub(crate) webtransport_enabled: bool,
pub(crate) extended_connect_enabled: bool,
pub(crate) panic_on_invalid_response_headers: bool,
}
impl HttpConfig {
pub const DEFAULT: Self = HttpConfig {
response_buffer_len: 512,
response_buffer_max_len: 2 * 1024 * 1024,
request_buffer_initial_len: 128,
head_max_len: 8 * 1024,
#[cfg(not(feature = "parse"))]
max_headers: 128,
response_header_initial_capacity: 16,
copy_loops_per_yield: 16,
received_body_max_len: 10 * 1024 * 1024,
received_body_initial_len: 128,
received_body_max_preallocate: 1024 * 1024,
max_header_list_size: 32 * 1024,
dynamic_table_capacity: 4096,
h3_blocked_streams: 100,
recent_pairs_size: 64,
h3_datagrams_enabled: false,
h2_initial_stream_window_size: 0,
h2_max_stream_recv_window_size: 1 << 20,
h2_initial_connection_window_size: 2 << 20,
h2_max_concurrent_streams: 100,
h2_max_frame_size: 16_384,
webtransport_enabled: false,
extended_connect_enabled: false,
panic_on_invalid_response_headers: cfg!(debug_assertions),
};
}
impl Default for HttpConfig {
fn default() -> Self {
HttpConfig::DEFAULT
}
}