1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:18:12 +00:00

LibWebSocket: Buffer incoming frame data until whole frame is available

Frames with large payloads may arrive in multiple chunks, so it's not
safe to assume that the whole frame is available for reading just
because we got a first "ready to read" notification.

This patch solves this in a very naive way by simply buffering incoming
frame data and trying to reparse a frame every time new data arrives.
This is definitely inefficient, but it works as a start.

With this, it's now possible to log in to Discord in Ladybird! :^)
This commit is contained in:
Andreas Kling 2022-11-08 19:57:44 +01:00
parent 0414d7f728
commit c15a65614f
2 changed files with 39 additions and 17 deletions

View file

@ -106,6 +106,8 @@ private:
ConnectionInfo m_connection;
RefPtr<WebSocketImpl> m_impl;
Vector<u8> m_buffered_data;
};
}