Skip to content
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

Websockets can time out randomly #1

Open
LBPHacker opened this issue Jun 10, 2023 · 0 comments
Open

Websockets can time out randomly #1

LBPHacker opened this issue Jun 10, 2023 · 0 comments

Comments

@LBPHacker
Copy link
Member

LBPHacker commented Jun 10, 2023

See daurnimator/lua-http#140, fixed by daurnimator/lua-http#197. This issue does not affect the instance managing the official server because it has the fix applied.

You can apply this fix yourself without too much hassle:

diff --git a/http/websocket.lua b/http/websocket.lua
index fe53f63..6c611a4 100644
--- a/http/websocket.lua
+++ b/http/websocket.lua
@@ -241,7 +241,7 @@ local function read_frame(sock, deadline)
        if frame.length == 126 then
                extra_fill_unget = assert(sock:xread(2, "b", 0))
                frame.length = sunpack(">I2", extra_fill_unget)
-               fill_length = fill_length - 2
+               fill_length = fill_length - 2 + frame.length
        elseif frame.length == 127 then
                extra_fill_unget = assert(sock:xread(8, "b", 0))
                frame.length = sunpack(">I8", extra_fill_unget)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant