Software /
code /
prosody
Comparison
plugins/mod_c2s.lua @ 11770:d2a9aa1c7ac8
mod_c2s,mod_s2s: Indicate stanza size violation with condition from XEP-0205 (thanks mjk)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 06 Sep 2021 23:21:25 +0200 |
parent | 11747:9f723b54e111 |
child | 11778:f254fd16218a |
comparison
equal
deleted
inserted
replaced
11769:071715a18394 | 11770:d2a9aa1c7ac8 |
---|---|
337 if data then | 337 if data then |
338 local ok, err = stream:feed(data); | 338 local ok, err = stream:feed(data); |
339 if not ok then | 339 if not ok then |
340 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300)); | 340 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300)); |
341 if err == "stanza-too-large" then | 341 if err == "stanza-too-large" then |
342 session:close({ condition = "policy-violation", text = "XML stanza is too big" }); | 342 session:close({ |
343 condition = "policy-violation", | |
344 text = "XML stanza is too big", | |
345 extra = st.stanza("stanza-too-big", { xmlns = 'urn:xmpp:errors' }), | |
346 }); | |
343 else | 347 else |
344 session:close("not-well-formed"); | 348 session:close("not-well-formed"); |
345 end | 349 end |
346 end | 350 end |
347 end | 351 end |