diff --git a/actix-http/src/config.rs b/actix-http/src/config.rs index f7d7f5f94..aba50a814 100644 --- a/actix-http/src/config.rs +++ b/actix-http/src/config.rs @@ -158,7 +158,8 @@ impl ServiceConfig { self.0.timer.now() } - pub(crate) fn set_date(&self, dst: &mut BytesMut) { + #[doc(hidden)] + pub fn set_date(&self, dst: &mut BytesMut) { let mut buf: [u8; 39] = [0; 39]; buf[..6].copy_from_slice(b"date: "); buf[6..35].copy_from_slice(&self.0.timer.date().bytes); diff --git a/actix-http/src/h1/codec.rs b/actix-http/src/h1/codec.rs index 1e1e1602f..22c7ed232 100644 --- a/actix-http/src/h1/codec.rs +++ b/actix-http/src/h1/codec.rs @@ -31,7 +31,7 @@ const AVERAGE_HEADER_SIZE: usize = 30; /// HTTP/1 Codec pub struct Codec { - pub(crate) config: ServiceConfig, + config: ServiceConfig, decoder: decoder::MessageDecoder, payload: Option, version: Version, @@ -104,6 +104,11 @@ impl Codec { MessageType::Payload } } + + #[inline] + pub fn config(&self) -> &ServiceConfig { + &self.config + } } impl Decoder for Codec { diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index 758466837..ec717ae07 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -567,7 +567,7 @@ where } if updated && self.ka_timer.is_some() { - if let Some(expire) = self.codec.config.keep_alive_expire() { + if let Some(expire) = self.codec.config().keep_alive_expire() { self.ka_expire = expire; } } @@ -579,7 +579,7 @@ where if self.ka_timer.is_none() { // shutdown timeout if self.flags.contains(Flags::SHUTDOWN) { - if let Some(interval) = self.codec.config.client_disconnect_timer() { + if let Some(interval) = self.codec.config().client_disconnect_timer() { self.ka_timer = Some(Delay::new(interval)); } else { self.flags.insert(Flags::READ_DISCONNECT); @@ -607,7 +607,7 @@ where // start shutdown timer if let Some(deadline) = - self.codec.config.client_disconnect_timer() + self.codec.config().client_disconnect_timer() { if let Some(timer) = self.ka_timer.as_mut() { timer.reset(deadline); @@ -632,7 +632,8 @@ where self.flags.insert(Flags::STARTED | Flags::SHUTDOWN); self.state = State::None; } - } else if let Some(deadline) = self.codec.config.keep_alive_expire() + } else if let Some(deadline) = + self.codec.config().keep_alive_expire() { if let Some(timer) = self.ka_timer.as_mut() { timer.reset(deadline);