Software /
code /
prosody
Changeset
11108:fa1821b56f75 0.11
mod_websocket: handle full frame buffer and raise stream error
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 16:41:48 +0100 |
parents | 11107:ddd0007e0f1b |
children | 11109:7ec7dba7ba8b |
files | plugins/mod_websocket.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_websocket.lua Thu Sep 17 13:04:46 2020 +0100 +++ b/plugins/mod_websocket.lua Thu Sep 17 16:41:48 2020 +0100 @@ -275,7 +275,11 @@ -- max frame header is 22 bytes local frameBuffer = dbuffer.new(stanza_size_limit + 22, frame_fragment_limit); add_filter(session, "bytes/in", function(data) - frameBuffer:write(data); + if not frameBuffer:write(data) then + session.log("warn", "websocket frame buffer full - terminating session"); + session:close({ condition = "resource-constraint", text = "frame buffer exceeded" }); + return; + end local cache = {}; local frame, length = parse_frame(frameBuffer);