mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
GH110: WebSocket accept() fails when Connection header contains multiple tokens
fixed GH #110: WebSocket accept() fails when Connection header contains multiple tokens
This commit is contained in:
@@ -12,6 +12,7 @@ Release 1.5.2 (2013-03-??)
|
|||||||
- merged GH #91: Improve SQLite multi-threaded use (by Rangel Reale)
|
- merged GH #91: Improve SQLite multi-threaded use (by Rangel Reale)
|
||||||
- merged GH #86: Invalid pointers to vector internals (by Adrian Imboden)
|
- merged GH #86: Invalid pointers to vector internals (by Adrian Imboden)
|
||||||
- automatic library initialization macros
|
- automatic library initialization macros
|
||||||
|
- fixed GH #110: WebSocket accept() fails when Connection header contains multiple tokens
|
||||||
|
|
||||||
Release 1.5.1 (2013-01-11)
|
Release 1.5.1 (2013-01-11)
|
||||||
==========================
|
==========================
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include "Poco/SHA1Engine.h"
|
#include "Poco/SHA1Engine.h"
|
||||||
#include "Poco/Base64Encoder.h"
|
#include "Poco/Base64Encoder.h"
|
||||||
#include "Poco/String.h"
|
#include "Poco/String.h"
|
||||||
|
#include "Poco/StringTokenizer.h"
|
||||||
#include "Poco/Random.h"
|
#include "Poco/Random.h"
|
||||||
#include "Poco/StreamCopier.h"
|
#include "Poco/StreamCopier.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -133,8 +134,8 @@ WebSocket::Mode WebSocket::mode() const
|
|||||||
|
|
||||||
WebSocketImpl* WebSocket::accept(HTTPServerRequest& request, HTTPServerResponse& response)
|
WebSocketImpl* WebSocket::accept(HTTPServerRequest& request, HTTPServerResponse& response)
|
||||||
{
|
{
|
||||||
if (icompare(request.get("Connection", ""), "Upgrade") == 0 &&
|
StringTokenizer st(request.get("Connection", ""), ",", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
|
||||||
icompare(request.get("Upgrade", ""), "websocket") == 0)
|
if (st.has("Upgrade") && icompare(request.get("Upgrade", ""), "websocket") == 0)
|
||||||
{
|
{
|
||||||
std::string version = request.get("Sec-WebSocket-Version", "");
|
std::string version = request.get("Sec-WebSocket-Version", "");
|
||||||
if (version.empty()) throw WebSocketException("Missing Sec-WebSocket-Version in handshake request", WS_ERR_HANDSHAKE_NO_VERSION);
|
if (version.empty()) throw WebSocketException("Missing Sec-WebSocket-Version in handshake request", WS_ERR_HANDSHAKE_NO_VERSION);
|
||||||
|
|||||||
@@ -251,7 +251,8 @@ void TCPServerTest::testMultiConnections()
|
|||||||
ss5.close();
|
ss5.close();
|
||||||
ss6.close();
|
ss6.close();
|
||||||
Thread::sleep(300);
|
Thread::sleep(300);
|
||||||
assert (srv.currentConnections() == 0);}
|
assert (srv.currentConnections() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TCPServerTest::setUp()
|
void TCPServerTest::setUp()
|
||||||
|
|||||||
Reference in New Issue
Block a user