Comparison

plugins/mod_c2s.lua @ 10111:0f335815244f

plugins: Remove tostring call from logging Taken care of by loggingmanager now Mass-rewrite using lua pattern like `tostring%b()`
author Kim Alvefur <zash@zash.se>
date Tue, 30 Jul 2019 02:29:36 +0200
parent 10017:994cccebb597
child 10226:77f900bbbf25
comparison
equal deleted inserted replaced
10110:3fa3872588a8 10111:0f335815244f
125 function stream_callbacks.error(session, error, data) 125 function stream_callbacks.error(session, error, data)
126 if error == "no-stream" then 126 if error == "no-stream" then
127 session.log("debug", "Invalid opening stream header (%s)", (data:gsub("^([^\1]+)\1", "{%1}"))); 127 session.log("debug", "Invalid opening stream header (%s)", (data:gsub("^([^\1]+)\1", "{%1}")));
128 session:close("invalid-namespace"); 128 session:close("invalid-namespace");
129 elseif error == "parse-error" then 129 elseif error == "parse-error" then
130 (session.log or log)("debug", "Client XML parse error: %s", tostring(data)); 130 (session.log or log)("debug", "Client XML parse error: %s", data);
131 session:close("not-well-formed"); 131 session:close("not-well-formed");
132 elseif error == "stream-error" then 132 elseif error == "stream-error" then
133 local condition, text = "undefined-condition"; 133 local condition, text = "undefined-condition";
134 for child in data:childtags(nil, xmlns_xmpp_streams) do 134 for child in data:childtags(nil, xmlns_xmpp_streams) do
135 if child.name ~= "text" then 135 if child.name ~= "text" then
287 if data then 287 if data then
288 data = filter("bytes/in", data); 288 data = filter("bytes/in", data);
289 if data then 289 if data then
290 local ok, err = stream:feed(data); 290 local ok, err = stream:feed(data);
291 if not ok then 291 if not ok then
292 log("debug", "Received invalid XML (%s) %d bytes: %q", tostring(err), #data, data:sub(1, 300)); 292 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300));
293 session:close("not-well-formed"); 293 session:close("not-well-formed");
294 end 294 end
295 end 295 end
296 end 296 end
297 end 297 end