Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ categories = ["network-programming", "web-programming::http-client", "web-progra
edition = "2021"
rust-version = "1.63"

[patch.crates-io]
hyper = { git = "https://github.com/finnbear/hyper", branch = "idle_timeout" }

[package.metadata.docs.rs]
features = ["full"]
rustdoc-args = ["--cfg", "docsrs"]
Expand Down
15 changes: 15 additions & 0 deletions src/server/conn/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,21 @@ impl<E> Http1Builder<'_, E> {
self
}

/// Set a timeout for idle time between requests. If a client does not
/// transmit another request within this time after receiving the last
/// response, the connection is closed.
///
/// Requires a [`Timer`] set by [`Builder::timer`] to take effect. Panics if `idle_timeout` is configured
/// without a [`Timer`].
///
/// Pass `None` to disable.
///
/// Default is currently 120 seconds, but do not depend on that.
pub fn idle_timeout(&mut self, idle_timeout: impl Into<Option<Duration>>) -> &mut Self {
self.inner.http1.idle_timeout(idle_timeout);
self
}

/// Set whether HTTP/1 connections should try to use vectored writes,
/// or always flatten into a single buffer.
///
Expand Down