mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
only auto-authorize if non-empty HTTPCredentials are provided
This commit is contained in:
parent
96a7263219
commit
5e678b925b
@ -183,6 +183,8 @@ WebSocketImpl* WebSocket::connect(HTTPClientSession& cs, HTTPRequest& request, H
|
||||
return completeHandshake(cs, response, key);
|
||||
}
|
||||
else if (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED)
|
||||
{
|
||||
if (!credentials.empty())
|
||||
{
|
||||
Poco::NullOutputStream null;
|
||||
Poco::StreamCopier::copyStream(istr, null);
|
||||
@ -203,6 +205,8 @@ WebSocketImpl* WebSocket::connect(HTTPClientSession& cs, HTTPRequest& request, H
|
||||
throw WebSocketException("Not authorized", WS_ERR_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
else 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);
|
||||
|
Loading…
Reference in New Issue
Block a user