aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-16 18:17:05 +0100
committerKim Alvefur <zash@zash.se>2021-03-16 18:17:05 +0100
commitb8c31f2d5c649cf0b0d5f1f8c2e8157ada744442 (patch)
tree917524e6146efc4094b759f64f9313ec225424d6
parent8bb22ccfedb17d8cc2e7c6916ab84c58e3c98ed6 (diff)
downloadprosody-b8c31f2d5c649cf0b0d5f1f8c2e8157ada744442.tar.gz
prosody-b8c31f2d5c649cf0b0d5f1f8c2e8157ada744442.zip
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!
-rw-r--r--plugins/mod_c2s.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index c5a9b42a..a99d965d 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -130,6 +130,10 @@ function stream_callbacks._streamopened(session, attr)
local features = st.stanza("stream:features");
hosts[session.host].events.fire_event("stream-features", { origin = session, features = features, stream = attr });
if features.tags[1] or session.full_jid then
+ if stanza_size_limit then
+ features:reset();
+ features:tag("stanza-size-limit", { xmlns = "xmpp:prosody.im/stream/limits", bytes = string.format("%d", stanza_size_limit) });
+ end
send(features);
else
if session.secure then