diff --git a/extend/lcodec/src/websocket.h b/extend/lcodec/src/websocket.h index 8f2e6fe1..ce3d6483 100644 --- a/extend/lcodec/src/websocket.h +++ b/extend/lcodec/src/websocket.h @@ -56,13 +56,13 @@ namespace lcodec { body = (uint8_t*)lua_tolstring(L, index + 1, len); } m_buf->write((0x80 | opcode)); - if (*len < 126) { + if (*len < 0x7e) { m_buf->write(*len); - } else if (*len < 0xffff) { - m_buf->write(126); + } else if (*len <= 0xffff) { + m_buf->write(0x7e); m_buf->write(byteswap2(*len)); } else { - m_buf->write(127); + m_buf->write(0x7f); m_buf->write(byteswap8(*len)); } m_buf->push_data(body, *len);