-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When Mojo WebSocket enables permessage-deflate, it causes abnormal data transmission. #2235
Comments
There is context here missing. What client/server are involved here? Could they have a broken permessage-deflate implementation? |
The client is tested with Mojolicious versions 8.71 to 9.39, and the systems include both Linux and Windows, with the same results. The server is opaque, so it is unknown, but it is known to have passed through Cloudflare WAF. I also tried implementing the same code in Python and JavaScript , and the results were normal; only the Perl Mojo implementation is not functioning correctly. |
I also tried injecting debug code into build_message:
Clearly, payload was not flushed to $out, result is as follows:
|
This issue occurs only with certain WebSocket server communications. When permessage-deflate is enabled, the first time the payload is sent, it works normally. However, when sending again the second time, it is found that the compressed payload generated by build_message is already corrupted, resulting in a 1006 disconnection. My solution is:
In Mojo::Transaction::WebSocket:
But I believe this is not the final or best fix.
Here is the debug info after enabling permessage-deflate:
Here is without permessage-deflate, it works fine:
The text was updated successfully, but these errors were encountered: