Comparison

mod_websocket/mod_websocket.lua @ 840:f568661c9d39

mod_websocket: Fix frame length calculation
author Florian Zeitz <florob@babelmonkeys.de>
date Thu, 04 Oct 2012 16:38:39 +0200
parent 839:d297d76010d4
child 842:32df4d13f178
comparison
equal deleted inserted replaced
839:d297d76010d4 840:f568661c9d39
67 result.length = 0; 67 result.length = 0;
68 end 68 end
69 69
70 for i = 1, length_bytes do 70 for i = 1, length_bytes do
71 pos = pos + 1; 71 pos = pos + 1;
72 result.length = result.length * 255 + string.byte(frame, pos); 72 result.length = result.length * 256 + string.byte(frame, pos);
73 end 73 end
74 74
75 if result.MASK then 75 if result.MASK then
76 result.key = {string.byte(frame, pos+1), string.byte(frame, pos+2), 76 result.key = {string.byte(frame, pos+1), string.byte(frame, pos+2),
77 string.byte(frame, pos+3), string.byte(frame, pos+4)} 77 string.byte(frame, pos+3), string.byte(frame, pos+4)}