Skip to content
Merged
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
16 changes: 16 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading