net/xmppcomponent_listener.lua

changeset 3634
0d6b57edb7bd
parent 3604
3e89f0509967
child 3706
b758e4ad30a0
equal deleted inserted replaced
3633:4069c37c54bc 3634:0d6b57edb7bd
40 log("warn", "Error processing component stream: "..tostring(error)); 40 log("warn", "Error processing component stream: "..tostring(error));
41 if error == "no-stream" then 41 if error == "no-stream" then
42 session:close("invalid-namespace"); 42 session:close("invalid-namespace");
43 elseif error == "parse-error" then 43 elseif error == "parse-error" then
44 session.log("warn", "External component %s XML parse error: %s", tostring(session.host), tostring(data)); 44 session.log("warn", "External component %s XML parse error: %s", tostring(session.host), tostring(data));
45 session:close("xml-not-well-formed"); 45 session:close("not-well-formed");
46 elseif error == "stream-error" then 46 elseif error == "stream-error" then
47 local condition, text = "undefined-condition"; 47 local condition, text = "undefined-condition";
48 for child in data:children() do 48 for child in data:children() do
49 if child.attr.xmlns == xmlns_xmpp_streams then 49 if child.attr.xmlns == xmlns_xmpp_streams then
50 if child.name ~= "text" then 50 if child.name ~= "text" then
184 184
185 function session.data(conn, data) 185 function session.data(conn, data)
186 local ok, err = parser:parse(data); 186 local ok, err = parser:parse(data);
187 if ok then return; end 187 if ok then return; end
188 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); 188 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_"));
189 session:close("xml-not-well-formed"); 189 session:close("not-well-formed");
190 end 190 end
191 191
192 session.dispatch_stanza = stream_callbacks.handlestanza; 192 session.dispatch_stanza = stream_callbacks.handlestanza;
193 193
194 end 194 end

mercurial