pub enum ConnectionError {
ApplicationClose {
code: Code,
},
Timeout,
Local(Violation),
Transport(ConnectionError),
}Expand description
Error affecting the whole HTTP/3 connection.
The variants are the four endings that need telling apart downstream: two of
them are ordinary goodbyes (crate::h3api::benign_close), and two are
faults. Everything the QUIC layer reports that is neither an application
close nor the idle timeout stays in ConnectionError::Transport with
quinn’s own error inside it, so nothing is flattened away before an operator
sees it.
Variants§
ApplicationClose
The peer closed the connection with an HTTP/3 error code.
Timeout
The peer went silent and the QUIC idle timeout expired.
Local(Violation)
This endpoint closed the connection because the peer broke a rule.
Transport(ConnectionError)
Anything else the QUIC layer reported, including our own local close.
Trait Implementations§
Source§impl Clone for ConnectionError
impl Clone for ConnectionError
Source§fn clone(&self) -> ConnectionError
fn clone(&self) -> ConnectionError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionError
impl Debug for ConnectionError
Source§impl Display for ConnectionError
impl Display for ConnectionError
Source§impl Error for ConnectionError
impl Error for ConnectionError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ConnectionError> for ConnectionError
impl From<ConnectionError> for ConnectionError
Source§fn from(error: ConnectionError) -> Self
fn from(error: ConnectionError) -> Self
Keeps exactly the two cases crate::h3api::benign_close grades on, and
takes the peer’s prose apart from its verdict on the way.
LocallyClosed deliberately stays in Transport: this server closes a
connection only for a reason worth reporting (a protocol violation, or
the authentication-failure budget), so it must not be filed alongside a
peer’s clean goodbye.
§The reason phrase
Both kinds of QUIC close carry a reason phrase (RFC 9000 §19.19), and it
is whatever bytes the peer felt like sending – bounded only by the
packet that carried it, and reaching this endpoint from anybody who can
complete a handshake, authenticated or not. It ends up in a production
log line: crate::quic records the whole error with % on the WARN
that closes a connection that ended badly, and Display escapes nothing.
A newline in there is a journal entry of the peer’s own composition,
attributed to this server, and a kilobyte of prose is a kilobyte of
journal per handshake.
The application half never had the problem: only the code survives the
conversion, because crate::h3api::benign_close grades on the code and
nothing downstream wanted the text. The transport half keeps quinn’s
error whole, which is worth keeping – a peer’s QUIC stack says useful
things there – so the phrase is bounded and escaped in place instead,
where the peer’s bytes enter this type rather than where they are logged
(the same point crate::auth cuts a claimed user-id at, and for the
same reason). crate::logfmt::peer_error is that cut, and it is the
same call crate::quic makes on the handshake that never got far
enough to reach this conversion at all.