Mercurial > prosody-hg
comparison net/xmppclient_listener.lua @ 2167:e41a6ea7fc0f
xmppclient_listener: Escape control characters when logging invalid XML.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Tue, 24 Nov 2009 22:42:08 +0500 |
| parents | e33658f6052c |
| children | 2abca9cc78b1 59dfb99831ae |
comparison
equal
deleted
inserted
replaced
| 2154:b8635ebd7f57 | 2167:e41a6ea7fc0f |
|---|---|
| 59 session.notopen = true; | 59 session.notopen = true; |
| 60 | 60 |
| 61 function session.data(conn, data) | 61 function session.data(conn, data) |
| 62 local ok, err = parser:parse(data); | 62 local ok, err = parser:parse(data); |
| 63 if ok then return; end | 63 if ok then return; end |
| 64 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); | 64 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); |
| 65 session:close("xml-not-well-formed"); | 65 session:close("xml-not-well-formed"); |
| 66 end | 66 end |
| 67 | 67 |
| 68 return true; | 68 return true; |
| 69 end | 69 end |
