mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +02:00
#550 WebSocket fragmented message problem
This commit is contained in:
@@ -76,7 +76,8 @@ public:
|
|||||||
FRAME_OP_CLOSE = 0x08, /// Close connection.
|
FRAME_OP_CLOSE = 0x08, /// Close connection.
|
||||||
FRAME_OP_PING = 0x09, /// Ping frame.
|
FRAME_OP_PING = 0x09, /// Ping frame.
|
||||||
FRAME_OP_PONG = 0x0a, /// Pong frame.
|
FRAME_OP_PONG = 0x0a, /// Pong frame.
|
||||||
FRAME_OP_BITMASK = 0x0f /// Bit mask for opcodes.
|
FRAME_OP_BITMASK = 0x0f, /// Bit mask for opcodes.
|
||||||
|
FRAME_OP_SETRAW = 0x100 /// Set raw flags (for use with sendBytes() and FRAME_OP_CONT).
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SendFlags
|
enum SendFlags
|
||||||
|
@@ -101,6 +101,7 @@ void WebSocket::shutdown(Poco::UInt16 statusCode, const std::string& statusMessa
|
|||||||
|
|
||||||
int WebSocket::sendFrame(const void* buffer, int length, int flags)
|
int WebSocket::sendFrame(const void* buffer, int length, int flags)
|
||||||
{
|
{
|
||||||
|
flags |= FRAME_OP_SETRAW;
|
||||||
return static_cast<WebSocketImpl*>(impl())->sendBytes(buffer, length, flags);
|
return static_cast<WebSocketImpl*>(impl())->sendBytes(buffer, length, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -61,6 +61,7 @@ int WebSocketImpl::sendBytes(const void* buffer, int length, int flags)
|
|||||||
Poco::BinaryWriter writer(ostr, Poco::BinaryWriter::NETWORK_BYTE_ORDER);
|
Poco::BinaryWriter writer(ostr, Poco::BinaryWriter::NETWORK_BYTE_ORDER);
|
||||||
|
|
||||||
if (flags == 0) flags = WebSocket::FRAME_BINARY;
|
if (flags == 0) flags = WebSocket::FRAME_BINARY;
|
||||||
|
flags &= 0xff;
|
||||||
writer << static_cast<Poco::UInt8>(flags);
|
writer << static_cast<Poco::UInt8>(flags);
|
||||||
Poco::UInt8 lengthByte(0);
|
Poco::UInt8 lengthByte(0);
|
||||||
if (_mustMaskPayload)
|
if (_mustMaskPayload)
|
||||||
|
Reference in New Issue
Block a user