aboutsummaryrefslogtreecommitdiffstats
path: root/net/websocket
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-10-12 21:29:20 +0200
committerKim Alvefur <zash@zash.se>2020-10-12 21:29:20 +0200
commitb0393fe9e1c0a46319cff8de8bb05d7b5dbcff3b (patch)
treee4d006dc4649263aa45d6fb1ce4103abfc20a1e3 /net/websocket
parentb4af560c9711221a4da3da41c8cef1d302b63beb (diff)
parentfb63187afceb8339b6142cc0b96162eb1c9af3b8 (diff)
downloadprosody-b0393fe9e1c0a46319cff8de8bb05d7b5dbcff3b.tar.gz
prosody-b0393fe9e1c0a46319cff8de8bb05d7b5dbcff3b.zip
Merge 0.11->trunk
Diffstat (limited to 'net/websocket')
-rw-r--r--net/websocket/frames.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/websocket/frames.lua b/net/websocket/frames.lua
index a0f3bd89..922a2fce 100644
--- a/net/websocket/frames.lua
+++ b/net/websocket/frames.lua
@@ -75,7 +75,7 @@ if s_unpack then
end
local function parse_frame_header(frame)
- if #frame < 2 then return; end
+ if frame:len() < 2 then return; end
local byte1, byte2 = frame:byte(1, 2);
local result = {
@@ -97,7 +97,7 @@ local function parse_frame_header(frame)
end
local header_length = 2 + length_bytes + (result.MASK and 4 or 0);
- if #frame < header_length then return; end
+ if frame:len() < header_length then return; end
if length_bytes == 2 then
result.length = read_uint16be(frame, 3);
@@ -140,7 +140,7 @@ end
local function parse_frame(frame)
local result, pos = parse_frame_header(frame);
- if result == nil or #frame < (pos + result.length) then return nil, nil, result; end
+ if result == nil or frame:len() < (pos + result.length) then return nil, nil, result; end
result.data = parse_frame_body(frame, result, pos+1);
return result, pos + result.length;
end