Comparison

plugins/mod_bosh.lua @ 11540:1937b3c3efb5 0.11

mod_c2s, mod_s2s, mod_component, mod_bosh, mod_websockets: Set default stanza size limits c2s/bosh/ws streams will default to 256KB, s2s and components to 512KB. These values are aligned with ejabberd's default settings, which should reduce issues related to inconsistent size limits between servers on the XMPP network. The previous default (10MB) is excessive for any production server, and allows significant memory usage by even unauthenticated sessions.
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 May 2021 17:03:49 +0100
parent 11124:1aea75b63d0a
child 11560:3bbb1af92514
comparison
equal deleted inserted replaced
11539:3413fea9e6db 11540:1937b3c3efb5
43 -- (the client can set this to a lower value when it connects, if it chooses) 43 -- (the client can set this to a lower value when it connects, if it chooses)
44 local bosh_max_wait = module:get_option_number("bosh_max_wait", 120); 44 local bosh_max_wait = module:get_option_number("bosh_max_wait", 120);
45 45
46 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure"); 46 local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure");
47 local cross_domain = module:get_option("cross_domain_bosh", false); 47 local cross_domain = module:get_option("cross_domain_bosh", false);
48 local stanza_size_limit = module:get_option_number("c2s_stanza_size_limit", 1024*256);
48 49
49 if cross_domain == true then cross_domain = "*"; end 50 if cross_domain == true then cross_domain = "*"; end
50 if type(cross_domain) == "table" then cross_domain = table.concat(cross_domain, ", "); end 51 if type(cross_domain) == "table" then cross_domain = table.concat(cross_domain, ", "); end
51 52
52 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; 53 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
113 local request, response = event.request, event.response; 114 local request, response = event.request, event.response;
114 response.on_destroy = on_destroy_request; 115 response.on_destroy = on_destroy_request;
115 local body = request.body; 116 local body = request.body;
116 117
117 local context = { request = request, response = response, notopen = true }; 118 local context = { request = request, response = response, notopen = true };
118 local stream = new_xmpp_stream(context, stream_callbacks); 119 local stream = new_xmpp_stream(context, stream_callbacks, stanza_size_limit);
119 response.context = context; 120 response.context = context;
120 121
121 local headers = response.headers; 122 local headers = response.headers;
122 headers.content_type = "text/xml; charset=utf-8"; 123 headers.content_type = "text/xml; charset=utf-8";
123 124