From ed4aeecca6acddd88d55add55452f50dc7dbfaaa Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 14 Nov 2025 12:11:09 -0500 Subject: [PATCH] docs(error): add more information about is_incomplete_message --- src/error.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/error.rs b/src/error.rs index 9015eeee9d..8b41f9c93d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -218,6 +218,22 @@ impl Error { } /// Returns true if the connection closed before a message could complete. + /// + /// This means that the supplied IO connection reported EOF (closed) while + /// hyper's HTTP state indicates more of the message (either request or + /// response) needed to be transmitted. + /// + /// Some cases this could happen (not exhaustive): + /// + /// - A request is written on a connection, and the next `read` reports + /// EOF (perhaps a server just closed an "idle" connection). + /// - A message body is only partially receive before the connection + /// reports EOF. + /// - A client writes a request to your server, and then closes the write + /// half while waiting for your response. If you need to support this, + /// consider enabling [`half_close`]. + /// + /// [`half_close`]: crate::server::conn::http1::Builder::half_close() pub fn is_incomplete_message(&self) -> bool { #[cfg(not(all(any(feature = "client", feature = "server"), feature = "http1")))] return false;