mod_websocket: Continue to process data already in the buffer after an error occurs 0.11
authorMatthew Wild <mwild1@gmail.com>
Mon, 28 Sep 2020 16:36:12 +0100
branch0.11
changeset 11115 55d8612ac357
parent 11114 67fb92e312f1
child 11116 bcc701377fe4
mod_websocket: Continue to process data already in the buffer after an error occurs Previously any error, or even a normal websocket close frame, would return early, leaving potentially entire frames in the buffer unprocessed and then discarded. This change stops processing new data, but returns an existing processed data up to the point of the error/close.
plugins/mod_websocket.lua
--- a/plugins/mod_websocket.lua	Thu Sep 17 16:42:36 2020 +0100
+++ b/plugins/mod_websocket.lua	Mon Sep 28 16:36:12 2020 +0100
@@ -291,7 +291,7 @@
 			end
 			frameBuffer:discard(length);
 			local result = handle_frame(frame);
-			if not result then return; end
+			if not result then break; end
 			cache[#cache+1] = filter_open_close(result);
 			frame, length = parse_frame(frameBuffer);
 		end