#[derive(Debug, Clone)]
pub struct Http1Options {
pub(crate) max_header_size: usize,
pub(crate) max_header_count: usize,
pub(crate) send_date_header: bool,
pub(crate) header_read_timeout: Option<std::time::Duration>,
pub(crate) send_continue_response: bool,
pub(crate) enable_early_hints: bool,
pub(crate) enable_vectored_write: bool,
}
impl Http1Options {
pub fn new() -> Self {
Self {
max_header_size: 16384,
max_header_count: 128,
send_date_header: true,
header_read_timeout: Some(std::time::Duration::from_secs(30)),
send_continue_response: true,
enable_early_hints: false,
enable_vectored_write: true,
}
}
pub fn max_header_size(mut self, size: usize) -> Self {
self.max_header_size = size;
self
}
pub fn max_header_count(mut self, count: usize) -> Self {
self.max_header_count = count;
self
}
pub fn send_date_header(mut self, send: bool) -> Self {
self.send_date_header = send;
self
}
pub fn enable_vectored_write(mut self, enable: bool) -> Self {
self.enable_vectored_write = enable;
self
}
pub fn header_read_timeout(mut self, timeout: Option<std::time::Duration>) -> Self {
self.header_read_timeout = timeout;
self
}
pub fn send_continue_response(mut self, send: bool) -> Self {
self.send_continue_response = send;
self
}
pub fn enable_early_hints(mut self, enable: bool) -> Self {
self.enable_early_hints = enable;
self
}
}
impl Default for Http1Options {
fn default() -> Self {
Self::new()
}
}