Comparison

plugins/mod_c2s.lua @ 10849:19e7092e062c

mod_c2s,mod_s2s: Use a distinct stream error for hitting stanza size limit Since this is not a real parse error, it should not be reported as such.
author Kim Alvefur <zash@zash.se>
date Sun, 31 May 2020 22:25:48 +0200
parent 10811:16bcbd574801
child 10850:bd2814f900dd
comparison
equal deleted inserted replaced
10848:7fd8976d47d7 10849:19e7092e062c
306 data = filter("bytes/in", data); 306 data = filter("bytes/in", data);
307 if data then 307 if data then
308 local ok, err = stream:feed(data); 308 local ok, err = stream:feed(data);
309 if not ok then 309 if not ok then
310 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300)); 310 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300));
311 session:close("not-well-formed"); 311 if err == "stanza-too-large" then
312 session:close({ condition = "policy-violation", text = "XML stanza is too big" });
313 else
314 session:close("not-well-formed");
315 end
312 end 316 end
313 end 317 end
314 end 318 end
315 end 319 end
316 320