From 91653036ce9199508fa1aa4e2ce613faec44cd70 Mon Sep 17 00:00:00 2001 From: James Coglan Date: Tue, 7 Jul 2015 20:49:29 +0100 Subject: [PATCH] Parse the mask flag and length in the order they appear in the protocol. --- lib/websocket/driver/hybi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/websocket/driver/hybi.rb b/lib/websocket/driver/hybi.rb index f3ee3ec..7b550cc 100644 --- a/lib/websocket/driver/hybi.rb +++ b/lib/websocket/driver/hybi.rb @@ -305,8 +305,8 @@ module WebSocket end def parse_length(data) - @frame.length = (data & LENGTH) @frame.masked = (data & MASK) == MASK + @frame.length = (data & LENGTH) if @frame.length >= 0 and @frame.length <= 125 @stage = @frame.masked ? 3 : 4