Software / code / prosody
Changeset
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 |
| parents | 12803:2e12290820e8 |
| children | 12805:d96e24bd54e1 |
| files | plugins/mod_c2s.lua |
| diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_c2s.lua Sun Nov 13 19:44:53 2022 +0100 +++ b/plugins/mod_c2s.lua Tue Mar 16 18:17:05 2021 +0100 @@ -130,6 +130,10 @@ 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