mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
improved WebSocket client error reporting
This commit is contained in:
parent
a00b202f6c
commit
364536c5fd
@ -1,7 +1,7 @@
|
||||
//
|
||||
// WebSocket.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/Net/src/WebSocket.cpp#6 $
|
||||
// $Id: //poco/1.4/Net/src/WebSocket.cpp#7 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: WebSocket
|
||||
@ -202,8 +202,15 @@ WebSocketImpl* WebSocket::connect(HTTPClientSession& cs, HTTPRequest& request, H
|
||||
throw WebSocketException("Not authorized", WS_ERR_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
if (response.getStatus() == HTTPResponse::HTTP_OK)
|
||||
{
|
||||
throw WebSocketException("The server does not understand the WebSocket protocol", WS_ERR_NO_HANDSHAKE);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw WebSocketException("Cannot upgrade to WebSocket connection", response.getReason(), WS_ERR_NO_HANDSHAKE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WebSocketImpl* WebSocket::completeHandshake(HTTPClientSession& cs, HTTPResponse& response, const std::string& key)
|
||||
|
Loading…
Reference in New Issue
Block a user