From 8bf26d1e394a8f207debe45445a5fb85cc349238 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 6 Nov 2023 13:25:59 -0500 Subject: [PATCH] feat(server): default `http1` `header_read_timeout` to 30 seconds --- src/server/conn/http1.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/conn/http1.rs b/src/server/conn/http1.rs index 272101e716..530f44177f 100644 --- a/src/server/conn/http1.rs +++ b/src/server/conn/http1.rs @@ -240,7 +240,7 @@ impl Builder { h1_keep_alive: true, h1_title_case_headers: false, h1_preserve_header_case: false, - h1_header_read_timeout: Dur::Default(None), + h1_header_read_timeout: Dur::Default(Some(Duration::from_secs(30))), h1_writev: None, max_buf_size: None, pipeline_flush: false, @@ -295,7 +295,9 @@ impl Builder { /// Set a timeout for reading client request headers. If a client does not /// transmit the entire header within this time, the connection is closed. /// - /// Default is None. + /// Pass `None` to disable. + /// + /// Default is 30 seconds. pub fn header_read_timeout(&mut self, read_timeout: impl Into>) -> &mut Self { self.h1_header_read_timeout = Dur::Configured(read_timeout.into()); self