You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In WebSocket.h several error codes for exceptions are defined:
enum ErrorCodes
/// These error codes can be obtained from a WebSocketException/// to determine the exact cause of the error.
{
WS_ERR_NO_HANDSHAKE = 1,
/// No Connection: Upgrade or Upgrade: websocket header in handshake request.
WS_ERR_HANDSHAKE_NO_VERSION = 2,
/// No Sec-WebSocket-Version header in handshake request.
WS_ERR_HANDSHAKE_UNSUPPORTED_VERSION = 3,
/// Unsupported WebSocket version requested by client.
WS_ERR_HANDSHAKE_NO_KEY = 4,
/// No Sec-WebSocket-Key header in handshake request.
WS_ERR_HANDSHAKE_ACCEPT = 5,
/// No Sec-WebSocket-Accept header or wrong value.
WS_ERR_UNAUTHORIZED = 6,
/// The server rejected the username or password for authentication.
WS_ERR_PAYLOAD_TOO_BIG = 10,
/// Payload too big for supplied buffer.
WS_ERR_INCOMPLETE_FRAME = 11/// Incomplete frame received.
};
There is also an error code WS_ERR_HANDSHAKE_ACCEPT which should be set to WebSocketException in case the header field Sec-WebSocket-Accept is missed in HTTP response or has invalid value. But instead WS_ERR_NO_HANDSHAKE is returned.
See method WebSocket::completeHandshake
WebSocketImpl* WebSocket::completeHandshake(HTTPClientSession& cs, HTTPResponse& response, const std::string& key)
{
std::string connection = response.get("Connection", "");
if (Poco::icompare(connection, "Upgrade") != 0)
throwWebSocketException("No Connection: Upgrade header in handshake response", WS_ERR_NO_HANDSHAKE);
std::string upgrade = response.get("Upgrade", "");
if (Poco::icompare(upgrade, "websocket") != 0)
throwWebSocketException("No Upgrade: websocket header in handshake response", WS_ERR_NO_HANDSHAKE);
std::string accept = response.get("Sec-WebSocket-Accept", "");
if (accept != computeAccept(key))
throwWebSocketException("Invalid or missing Sec-WebSocket-Accept header in handshake response", WS_ERR_NO_HANDSHAKE);
returnnewWebSocketImpl(static_cast<StreamSocketImpl*>(cs.detachSocket().impl()), true);
}
Detect in version 1.6.0
In version 1.6.1 it is the same.
The text was updated successfully, but these errors were encountered:
In WebSocket.h several error codes for exceptions are defined:
There is also an error code WS_ERR_HANDSHAKE_ACCEPT which should be set to WebSocketException in case the header field Sec-WebSocket-Accept is missed in HTTP response or has invalid value. But instead WS_ERR_NO_HANDSHAKE is returned.
See method WebSocket::completeHandshake
Detect in version 1.6.0
In version 1.6.1 it is the same.
The text was updated successfully, but these errors were encountered: