-
Notifications
You must be signed in to change notification settings - Fork 669
Description
First of all, thank you for maintaining Boost.Beast! It’s an excellent library with great design and documentation, and it has been very helpful for our WebSocket projects.
While using Boost.Beast extensively, we encountered an issue that seems unusual and might be a bug, specifically related to permessage-deflate compression in the WebSocket client.
That said, when using Boost.Beast as a WebSocket client with permessage-deflate enabled, we occasionally encounter errors during async_read. Specifically, the error code returned is:
ec: invalid stored block length
We used the following WebSocket client configuration:
websocket::permessage_deflate pmd;
pmd.client_enable = true;
pmd.server_enable = true;
pmd.client_no_context_takeover = false;
pmd.server_no_context_takeover = false;
ws.set_option(pmd);
During communication, async_read sometimes fails with the above error.
We captured the traffic using Wireshark, and the problematic packet can be read and decompressed correctly by Wireshark, which suggests the issue may be in the client-side handling of compressed frames rather than in the network data.
After further investigation, we were able to narrow down the potential cause. We created a minimal example that reliably reproduces the issue. In addition, we submitted a pull request proposing a fix, and testing shows that the proposed changes successfully resolve the problem:
We realize that our understanding of the internal workings of Boost.Beast, especially in the permessage-deflate implementation, is limited. We would greatly appreciate it if the maintainers could take a closer look and provide guidance or suggestions for a more robust solution. Your expertise would be invaluable in helping us understand and properly address this issue.