Software /
code /
prosody
Diff
plugins/mod_websocket.lua @ 11109:7ec7dba7ba8b 0.11
mod_websocket: Add separate limit for frame buffer size
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 16:42:14 +0100 |
parent | 11108:fa1821b56f75 |
child | 11110:67fb92e312f1 |
line wrap: on
line diff
--- a/plugins/mod_websocket.lua Thu Sep 17 16:41:48 2020 +0100 +++ b/plugins/mod_websocket.lua Thu Sep 17 16:42:14 2020 +0100 @@ -29,6 +29,7 @@ local t_concat = table.concat; local stanza_size_limit = module:get_option_number("c2s_stanza_size_limit", 10 * 1024 * 1024); +local frame_buffer_limit = module:get_option_number("websocket_frame_buffer_limit", 2 * stanza_size_limit); local frame_fragment_limit = module:get_option_number("websocket_frame_fragment_limit", 8); local stream_close_timeout = module:get_option_number("c2s_close_timeout", 5); local consider_websocket_secure = module:get_option_boolean("consider_websocket_secure"); @@ -272,8 +273,7 @@ session.open_stream = session_open_stream; session.close = session_close; - -- max frame header is 22 bytes - local frameBuffer = dbuffer.new(stanza_size_limit + 22, frame_fragment_limit); + local frameBuffer = dbuffer.new(frame_buffer_limit, frame_fragment_limit); add_filter(session, "bytes/in", function(data) if not frameBuffer:write(data) then session.log("warn", "websocket frame buffer full - terminating session");