/// HTTP/2 error codes. /// /// Error codes are used in `RST_STREAM` and `GOAWAY` frames to convey the /// reasons for the stream or connection error. For example, /// [`SendStream::send_reset`] takes a `Reason` argument. Also, the `Error` type /// may contain a `Reason`. /// /// Error codes share a common code space. Some error codes apply only to /// streams, others apply only to connections, and others may apply to either. /// See [RFC 7540] for more information. /// /// See [Error Codes in the spec][spec]. /// /// [spec]: http://httpwg.org/specs/rfc7540.html#ErrorCodes /// [`SendStream::send_reset`]: struct.SendStream.html#method.send_reset #[derive(PartialEq, Eq, Clone, Copy)] pubstruct Reason(u32);
impl Reason { /// The associated condition is not a result of an error. /// /// For example, a GOAWAY might include this code to indicate graceful /// shutdown of a connection. pubconst NO_ERROR: Reason = Reason(0); /// The endpoint detected an unspecific protocol error. /// /// This error is for use when a more specific error code is not available. pubconst PROTOCOL_ERROR: Reason = Reason(1); /// The endpoint encountered an unexpected internal error. pubconst INTERNAL_ERROR: Reason = Reason(2); /// The endpoint detected that its peer violated the flow-control protocol. pubconst FLOW_CONTROL_ERROR: Reason = Reason(3); /// The endpoint sent a SETTINGS frame but did not receive a response in /// a timely manner. pubconst SETTINGS_TIMEOUT: Reason = Reason(4); /// The endpoint received a frame after a stream was half-closed. pubconst STREAM_CLOSED: Reason = Reason(5); /// The endpoint received a frame with an invalid size. pubconst FRAME_SIZE_ERROR: Reason = Reason(6); /// The endpoint refused the stream prior to performing any application /// processing. pubconst REFUSED_STREAM: Reason = Reason(7); /// Used by the endpoint to indicate that the stream is no longer needed. pubconst CANCEL: Reason = Reason(8); /// The endpoint is unable to maintain the header compression context for /// the connection. pubconst COMPRESSION_ERROR: Reason = Reason(9); /// The connection established in response to a CONNECT request was reset /// or abnormally closed. pubconst CONNECT_ERROR: Reason = Reason(10); /// The endpoint detected that its peer is exhibiting a behavior that might /// be generating excessive load. pubconst ENHANCE_YOUR_CALM: Reason = Reason(11); /// The underlying transport has properties that do not meet minimum /// security requirements. pubconst INADEQUATE_SECURITY: Reason = Reason(12); /// The endpoint requires that HTTP/1.1 be used instead of HTTP/2. pubconst HTTP_1_1_REQUIRED: Reason = Reason(13);
/// Get a string description of the error code. pubfn description(&self) -> &str { matchself.0 { 0 => "not a result of an error", 1 => "unspecific protocol error detected", 2 => "unexpected internal error encountered", 3 => "flow-control protocol violated", 4 => "settings ACK not received in timely manner", 5 => "received frame when stream half-closed", 6 => "frame with invalid size", 7 => "refused stream before processing any application logic", 8 => "stream no longer needed", 9 => "unable to maintain the header compression context", 10 => { "connection established in response to a CONNECT request was reset or abnormally \
closed"
} 11 => "detected excessive load generating behavior", 12 => "security properties do not meet minimum requirements", 13 => "endpoint requires HTTP/1.1",
_ => "unknown reason",
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.