#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CloseReason {
ClientConnectionClose,
ServerConnectionClose,
Not100Continue,
CloseDelimitedBody,
}
impl CloseReason {
pub(crate) fn explain(&self) -> &'static str {
match self {
CloseReason::ClientConnectionClose => "client sent Connection: close",
CloseReason::ServerConnectionClose => "server sent Connection: close",
CloseReason::Not100Continue => "non-100 response before body",
CloseReason::CloseDelimitedBody => "response body is close delimited",
}
}
}