Diff

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
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Wed May 27 19:44:12 2020 +0200
+++ b/plugins/mod_c2s.lua	Sun May 31 22:25:48 2020 +0200
@@ -308,7 +308,11 @@
 				local ok, err = stream:feed(data);
 				if not ok then
 					log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300));
-					session:close("not-well-formed");
+					if err == "stanza-too-large" then
+						session:close({ condition = "policy-violation", text = "XML stanza is too big" });
+					else
+						session:close("not-well-formed");
+					end
 				end
 			end
 		end