Skip to content

Commit 793af1e

Browse files
authored
docs(error): add more information about is_incomplete_message() (#3978)
1 parent 166c6ca commit 793af1e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/error.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,22 @@ impl Error {
218218
}
219219

220220
/// Returns true if the connection closed before a message could complete.
221+
///
222+
/// This means that the supplied IO connection reported EOF (closed) while
223+
/// hyper's HTTP state indicates more of the message (either request or
224+
/// response) needed to be transmitted.
225+
///
226+
/// Some cases this could happen (not exhaustive):
227+
///
228+
/// - A request is written on a connection, and the next `read` reports
229+
/// EOF (perhaps a server just closed an "idle" connection).
230+
/// - A message body is only partially receive before the connection
231+
/// reports EOF.
232+
/// - A client writes a request to your server, and then closes the write
233+
/// half while waiting for your response. If you need to support this,
234+
/// consider enabling [`half_close`].
235+
///
236+
/// [`half_close`]: crate::server::conn::http1::Builder::half_close()
221237
pub fn is_incomplete_message(&self) -> bool {
222238
#[cfg(not(all(any(feature = "client", feature = "server"), feature = "http1")))]
223239
return false;

0 commit comments

Comments
 (0)