Created attachment 32425 [details] Fix bit finagling in lua_websocket_read() The finagling of bits in mod_lua's lua_websocket_read() seems to be a bit off. The size of char is assumed to be 8 bits, and char is assumed to be unsigned. When these two assumptions aren't met, bad things happen; in the worst case, I got the wrong opcode and payload length because of sign extending. The attached patch corrects the bit operations. As a bonus, it also comments another (unrelated) assumption the implementation makes - something to be fixed later.
Another patch has been applied to trunk (r1657261) and backported to 2.4.x (r1664118). It is now part of the (unreleased) 2.4.13. Looking different from your proposal, could you please check if it solves your issue?
Looks like this specific problem was fixed in r1657256 in trunk and r1664117 in 2.4.x. Closing the bug report.