From 7de02373f5e4ce392587a4d9d7710c6faf9c6165 Mon Sep 17 00:00:00 2001 From: yhx-12243 Date: Wed, 31 Jul 2024 09:06:27 -0400 Subject: [PATCH] fix(http1): make `date_header` effective (#3718) Before this patch, the option was not fully propagated to the inner server conn state object. Now it is. --- src/proto/h1/conn.rs | 5 +++++ src/server/conn/http1.rs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/proto/h1/conn.rs b/src/proto/h1/conn.rs index 744e1b2ae5..10f4f87b40 100644 --- a/src/proto/h1/conn.rs +++ b/src/proto/h1/conn.rs @@ -152,6 +152,11 @@ where self.state.allow_half_close = true; } + #[cfg(feature = "server")] + pub(crate) fn disable_date_header(&mut self) { + self.state.date_header = false; + } + pub(crate) fn into_inner(self) -> (I, Bytes) { self.io.into_inner() } diff --git a/src/server/conn/http1.rs b/src/server/conn/http1.rs index a1e3325785..097497bf41 100644 --- a/src/server/conn/http1.rs +++ b/src/server/conn/http1.rs @@ -459,6 +459,9 @@ impl Builder { if let Some(max) = self.max_buf_size { conn.set_max_buf_size(max); } + if !self.date_header { + conn.disable_date_header(); + } let sd = proto::h1::dispatch::Server::new(service); let proto = proto::h1::Dispatcher::new(sd, conn); Connection { conn: proto }