Diff

spec/net_websocket_frames_spec.lua @ 11165:eae8046d51fc 0.11

net.websocket.frames: Add test for empty frame with MASK and key set
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Oct 2020 14:01:22 +0100
parent 11164:4e5a2af9dd19
child 11166:51e5149ed0ad
line wrap: on
line diff
--- a/spec/net_websocket_frames_spec.lua	Wed Oct 14 19:41:42 2020 +0200
+++ b/spec/net_websocket_frames_spec.lua	Thu Oct 15 14:01:22 2020 +0100
@@ -43,6 +43,15 @@
 			["RSV2"] = false;
 			["RSV3"] = false;
 		};
+		empty_with_mask = {
+			["opcode"] = 0;
+			["key"] = " \0 \0";
+			["FIN"] = true;
+			["MASK"] = true;
+			["RSV1"] = false;
+			["RSV2"] = false;
+			["RSV3"] = false;
+		};
 	}
 
 	describe("build", function ()
@@ -52,6 +61,7 @@
 			assert.equal("\0\5hello", build(test_frames.simple_data));
 			assert.equal("\128\0", build(test_frames.simple_fin));
 			assert.equal("\128\133 \0 \0HeLlO", build(test_frames.with_mask))
+			assert.equal("\128\128 \0 \0", build(test_frames.empty_with_mask))
 		end);
 	end);