Software /
code /
prosody
Comparison
plugins/mod_websocket.lua @ 11110:67fb92e312f1 0.11
mod_websocket: Enforce stanza size limit and close stream
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 16:42:36 +0100 |
parent | 11109:7ec7dba7ba8b |
child | 11111:55d8612ac357 |
comparison
equal
deleted
inserted
replaced
11109:7ec7dba7ba8b | 11110:67fb92e312f1 |
---|---|
283 | 283 |
284 local cache = {}; | 284 local cache = {}; |
285 local frame, length = parse_frame(frameBuffer); | 285 local frame, length = parse_frame(frameBuffer); |
286 | 286 |
287 while frame do | 287 while frame do |
288 if length > stanza_size_limit then | |
289 session:close({ condition = "policy-violation", text = "stanza too large" }); | |
290 return; | |
291 end | |
288 frameBuffer:discard(length); | 292 frameBuffer:discard(length); |
289 local result = handle_frame(frame); | 293 local result = handle_frame(frame); |
290 if not result then return; end | 294 if not result then return; end |
291 cache[#cache+1] = filter_open_close(result); | 295 cache[#cache+1] = filter_open_close(result); |
292 frame, length = parse_frame(frameBuffer); | 296 frame, length = parse_frame(frameBuffer); |