Comparison

plugins/mod_c2s.lua @ 12804:3eef052c72d8

mod_c2s: Advertise stanza size limit to clients Should help clients avoid sending stanzas that will get their stream killed. Custom namespace while ironing out the protocol. My spoon is too big!
author Kim Alvefur <zash@zash.se>
date Tue, 16 Mar 2021 18:17:05 +0100
parent 12773:f100c1035576
child 12808:12bd40b8e105
comparison
equal deleted inserted replaced
12803:2e12290820e8 12804:3eef052c72d8
128 end 128 end
129 129
130 local features = st.stanza("stream:features"); 130 local features = st.stanza("stream:features");
131 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features, stream = attr }); 131 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features, stream = attr });
132 if features.tags[1] or session.full_jid then 132 if features.tags[1] or session.full_jid then
133 if stanza_size_limit then
134 features:reset();
135 features:tag("stanza-size-limit", { xmlns = "xmpp:prosody.im/stream/limits", bytes = string.format("%d", stanza_size_limit) });
136 end
133 send(features); 137 send(features);
134 else 138 else
135 if session.secure then 139 if session.secure then
136 -- Here SASL should be offered 140 -- Here SASL should be offered
137 (session.log or log)("warn", "No stream features to offer on secure session. Check authentication settings."); 141 (session.log or log)("warn", "No stream features to offer on secure session. Check authentication settings.");