Enum tungstenite::error::ProtocolError
source · pub enum ProtocolError {
Show 26 variants
WrongHttpMethod,
WrongHttpVersion,
MissingConnectionUpgradeHeader,
MissingUpgradeWebSocketHeader,
MissingSecWebSocketVersionHeader,
MissingSecWebSocketKey,
SecWebSocketAcceptKeyMismatch,
JunkAfterRequest,
CustomResponseSuccessful,
InvalidHeader(HeaderName),
HandshakeIncomplete,
HttparseError(Error),
SendAfterClosing,
ReceivedAfterClosing,
NonZeroReservedBits,
UnmaskedFrameFromClient,
MaskedFrameFromServer,
FragmentedControlFrame,
ControlFrameTooBig,
UnknownControlFrameType(u8),
UnknownDataFrameType(u8),
UnexpectedContinueFrame,
ExpectedFragment(Data),
ResetWithoutClosingHandshake,
InvalidOpcode(u8),
InvalidCloseSequence,
}
Expand description
Indicates the specific type/cause of a protocol error.
Variants§
WrongHttpMethod
Use of the wrong HTTP method (the WebSocket protocol requires the GET method be used).
WrongHttpVersion
Wrong HTTP version used (the WebSocket protocol requires version 1.1 or higher).
MissingConnectionUpgradeHeader
Missing Connection: upgrade
HTTP header.
MissingUpgradeWebSocketHeader
Missing Upgrade: websocket
HTTP header.
MissingSecWebSocketVersionHeader
Missing Sec-WebSocket-Version: 13
HTTP header.
MissingSecWebSocketKey
Missing Sec-WebSocket-Key
HTTP header.
SecWebSocketAcceptKeyMismatch
The Sec-WebSocket-Accept
header is either not present or does not specify the correct key value.
JunkAfterRequest
Garbage data encountered after client request.
CustomResponseSuccessful
Custom responses must be unsuccessful.
InvalidHeader(HeaderName)
Invalid header is passed. Or the header is missing in the request. Or not present at all. Check the request that you pass.
HandshakeIncomplete
No more data while still performing handshake.
HttparseError(Error)
Wrapper around a httparse::Error
value.
SendAfterClosing
Not allowed to send after having sent a closing frame.
ReceivedAfterClosing
Remote sent data after sending a closing frame.
NonZeroReservedBits
Reserved bits in frame header are non-zero.
UnmaskedFrameFromClient
The server must close the connection when an unmasked frame is received.
MaskedFrameFromServer
The client must close the connection when a masked frame is received.
FragmentedControlFrame
Control frames must not be fragmented.
ControlFrameTooBig
Control frames must have a payload of 125 bytes or less.
UnknownControlFrameType(u8)
Type of control frame not recognised.
UnknownDataFrameType(u8)
Type of data frame not recognised.
UnexpectedContinueFrame
Received a continue frame despite there being nothing to continue.
ExpectedFragment(Data)
Received data while waiting for more fragments.
ResetWithoutClosingHandshake
Connection closed without performing the closing handshake.
InvalidOpcode(u8)
Encountered an invalid opcode.
InvalidCloseSequence
The payload for the closing frame is invalid.
Trait Implementations§
source§impl Clone for ProtocolError
impl Clone for ProtocolError
source§fn clone(&self) -> ProtocolError
fn clone(&self) -> ProtocolError
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ProtocolError
impl Debug for ProtocolError
source§impl Display for ProtocolError
impl Display for ProtocolError
source§impl Error for ProtocolError
impl Error for ProtocolError
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
source§impl From<Error> for ProtocolError
impl From<Error> for ProtocolError
source§impl From<ProtocolError> for Error
impl From<ProtocolError> for Error
source§fn from(source: ProtocolError) -> Self
fn from(source: ProtocolError) -> Self
source§impl PartialEq for ProtocolError
impl PartialEq for ProtocolError
source§fn eq(&self, other: &ProtocolError) -> bool
fn eq(&self, other: &ProtocolError) -> bool
self
and other
values to be equal, and is used
by ==
.