#550 WebSocket fragmented message problem

This commit is contained in:
Guenter Obiltschnig 2014-10-02 20:24:50 +02:00
parent 84adc737d4
commit cd67863852
3 changed files with 4 additions and 1 deletions

View File

@ -76,7 +76,8 @@ public:
FRAME_OP_CLOSE = 0x08, /// Close connection.
FRAME_OP_PING = 0x09, /// Ping 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

View File

@ -101,6 +101,7 @@ void WebSocket::shutdown(Poco::UInt16 statusCode, const std::string& statusMessa
int WebSocket::sendFrame(const void* buffer, int length, int flags)
{
flags |= FRAME_OP_SETRAW;
return static_cast<WebSocketImpl*>(impl())->sendBytes(buffer, length, flags);
}

View File

@ -61,6 +61,7 @@ int WebSocketImpl::sendBytes(const void* buffer, int length, int flags)
Poco::BinaryWriter writer(ostr, Poco::BinaryWriter::NETWORK_BYTE_ORDER);
if (flags == 0) flags = WebSocket::FRAME_BINARY;
flags &= 0xff;
writer << static_cast<Poco::UInt8>(flags);
Poco::UInt8 lengthByte(0);
if (_mustMaskPayload)