Software /
code /
prosody
Comparison
net/xmppclient_listener.lua @ 3634:0d6b57edb7bd
net.xmpp{client,server,component}_listener: s/xml-not-well-formed/not-well-formed/ as per latest bis drafts.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 20 Nov 2010 02:33:36 +0500 |
parent | 3423:929fb7b65d2c |
child | 3756:db7183f07114 |
comparison
equal
deleted
inserted
replaced
3633:4069c37c54bc | 3634:0d6b57edb7bd |
---|---|
39 if error == "no-stream" then | 39 if error == "no-stream" then |
40 session.log("debug", "Invalid opening stream header"); | 40 session.log("debug", "Invalid opening stream header"); |
41 session:close("invalid-namespace"); | 41 session:close("invalid-namespace"); |
42 elseif error == "parse-error" then | 42 elseif error == "parse-error" then |
43 (session.log or log)("debug", "Client XML parse error: %s", tostring(data)); | 43 (session.log or log)("debug", "Client XML parse error: %s", tostring(data)); |
44 session:close("xml-not-well-formed"); | 44 session:close("not-well-formed"); |
45 elseif error == "stream-error" then | 45 elseif error == "stream-error" then |
46 local condition, text = "undefined-condition"; | 46 local condition, text = "undefined-condition"; |
47 for child in data:children() do | 47 for child in data:children() do |
48 if child.attr.xmlns == xmlns_xmpp_streams then | 48 if child.attr.xmlns == xmlns_xmpp_streams then |
49 if child.name ~= "text" then | 49 if child.name ~= "text" then |
146 data = filter("bytes/in", data); | 146 data = filter("bytes/in", data); |
147 if data then | 147 if data then |
148 local ok, err = stream:feed(data); | 148 local ok, err = stream:feed(data); |
149 if ok then return; end | 149 if ok then return; end |
150 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); | 150 log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); |
151 session:close("xml-not-well-formed"); | 151 session:close("not-well-formed"); |
152 end | 152 end |
153 end | 153 end |
154 | 154 |
155 local handlestanza = stream_callbacks.handlestanza; | 155 local handlestanza = stream_callbacks.handlestanza; |
156 function session.dispatch_stanza(session, stanza) | 156 function session.dispatch_stanza(session, stanza) |