Comparison

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
comparison
equal deleted inserted replaced
11016:5176d9f727f6 11018:bacca65ce107
593 function session.data(data) 593 function session.data(data)
594 data = filter("bytes/in", data); 594 data = filter("bytes/in", data);
595 if data then 595 if data then
596 local ok, err = stream:feed(data); 596 local ok, err = stream:feed(data);
597 if ok then return; end 597 if ok then return; end
598 log("warn", "Received invalid XML: %s", data); 598 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_"));
599 log("warn", "Problem was: %s", err);
600 session:close("not-well-formed"); 599 session:close("not-well-formed");
601 end 600 end
602 end 601 end
603 602
604 session.close = session_close; 603 session.close = session_close;