Diff

plugins/mod_s2s/mod_s2s.lua @ 11018:bacca65ce107 0.11 0.11.6

mod_s2s: Escape invalid XML in loggin (same way as mod_c2s) fix #1574
author Kim Alvefur <zash@zash.se>
date Sat, 01 Aug 2020 12:58:37 +0200
parent 9449:94033a2529b9
child 11118:ece430d49809
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Sat Aug 08 13:13:50 2020 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Sat Aug 01 12:58:37 2020 +0200
@@ -595,8 +595,7 @@
 		if data then
 			local ok, err = stream:feed(data);
 			if ok then return; end
-			log("warn", "Received invalid XML: %s", data);
-			log("warn", "Problem was: %s", err);
+			log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_"));
 			session:close("not-well-formed");
 		end
 	end