Software /
code /
prosody
Comparison
plugins/mod_websocket.lua @ 11111:55d8612ac357 0.11
mod_websocket: Continue to process data already in the buffer after an error occurs
Previously any error, or even a normal websocket close frame, would return early,
leaving potentially entire frames in the buffer unprocessed and then discarded.
This change stops processing new data, but returns an existing processed data up
to the point of the error/close.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 28 Sep 2020 16:36:12 +0100 |
parent | 11110:67fb92e312f1 |
child | 11113:10301c214f4e |
comparison
equal
deleted
inserted
replaced
11110:67fb92e312f1 | 11111:55d8612ac357 |
---|---|
289 session:close({ condition = "policy-violation", text = "stanza too large" }); | 289 session:close({ condition = "policy-violation", text = "stanza too large" }); |
290 return; | 290 return; |
291 end | 291 end |
292 frameBuffer:discard(length); | 292 frameBuffer:discard(length); |
293 local result = handle_frame(frame); | 293 local result = handle_frame(frame); |
294 if not result then return; end | 294 if not result then break; end |
295 cache[#cache+1] = filter_open_close(result); | 295 cache[#cache+1] = filter_open_close(result); |
296 frame, length = parse_frame(frameBuffer); | 296 frame, length = parse_frame(frameBuffer); |
297 end | 297 end |
298 return t_concat(cache, ""); | 298 return t_concat(cache, ""); |
299 end); | 299 end); |