Changeset

1605:f6bd13fe1cb1

xmpp{client,server}_listener: Report contents of packets containing invalid XML
author Matthew Wild <mwild1@gmail.com>
date Sun, 26 Jul 2009 20:58:37 +0100
parents 1604:5097583259e0
children 1607:d81f5bb1f6b8
files net/xmppclient_listener.lua net/xmppserver_listener.lua
diffstat 2 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/xmppclient_listener.lua	Sun Jul 26 17:05:18 2009 +0100
+++ b/net/xmppclient_listener.lua	Sun Jul 26 20:58:37 2009 +0100
@@ -61,6 +61,7 @@
 		function session.data(conn, data)
 			local ok, err = parser:parse(data);
 			if ok then return; end
+			log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "));
 			session:close("xml-not-well-formed");
 		end
 		
--- a/net/xmppserver_listener.lua	Sun Jul 26 17:05:18 2009 +0100
+++ b/net/xmppserver_listener.lua	Sun Jul 26 20:58:37 2009 +0100
@@ -61,6 +61,7 @@
 		function session.data(conn, data)
 			local ok, err = parser:parse(data);
 			if ok then return; end
+			log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "));
 			session:close("xml-not-well-formed");
 		end