Software /
code /
prosody
Comparison
plugins/mod_c2s.lua @ 8232:176b7f4e4ac9
mod_c2s: Iterate over child tags instead of child nodes in stream error (fixes traceback from #987)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 13 Sep 2017 18:18:57 +0200 |
parent | 7328:de76ded98b84 |
child | 8234:97b3ca502547 |
child | 8844:29c6d2681bad |
comparison
equal
deleted
inserted
replaced
8224:776789a98047 | 8232:176b7f4e4ac9 |
---|---|
96 elseif error == "parse-error" then | 96 elseif error == "parse-error" then |
97 (session.log or log)("debug", "Client XML parse error: %s", tostring(data)); | 97 (session.log or log)("debug", "Client XML parse error: %s", tostring(data)); |
98 session:close("not-well-formed"); | 98 session:close("not-well-formed"); |
99 elseif error == "stream-error" then | 99 elseif error == "stream-error" then |
100 local condition, text = "undefined-condition"; | 100 local condition, text = "undefined-condition"; |
101 for child in data:children() do | 101 for child in data:childtags(nil, xmlns_xmpp_streams) do |
102 if child.attr.xmlns == xmlns_xmpp_streams then | 102 if child.name ~= "text" then |
103 if child.name ~= "text" then | 103 condition = child.name; |
104 condition = child.name; | 104 else |
105 else | 105 text = child:get_text(); |
106 text = child:get_text(); | 106 end |
107 end | 107 if condition ~= "undefined-condition" and text then |
108 if condition ~= "undefined-condition" and text then | 108 break; |
109 break; | |
110 end | |
111 end | 109 end |
112 end | 110 end |
113 text = condition .. (text and (" ("..text..")") or ""); | 111 text = condition .. (text and (" ("..text..")") or ""); |
114 session.log("info", "Session closed by remote with error: %s", text); | 112 session.log("info", "Session closed by remote with error: %s", text); |
115 session:close(nil, text); | 113 session:close(nil, text); |