84 self:add_plugin("session"); |
84 self:add_plugin("session"); |
85 |
85 |
86 function self.data(conn, data) |
86 function self.data(conn, data) |
87 local ok, err = self.stream:feed(data); |
87 local ok, err = self.stream:feed(data); |
88 if ok then return; end |
88 if ok then return; end |
89 self:debug("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); |
89 self:debug("Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); |
90 self:close("xml-not-well-formed"); |
90 self:close("xml-not-well-formed"); |
91 end |
91 end |
92 |
92 |
93 self:hook("connected", function () self:reopen(); end); |
93 self:hook("connected", function () self:reopen(); end); |
94 self:hook("incoming-raw", function (data) return self.data(self.conn, data); end); |
94 self:hook("incoming-raw", function (data) return self.data(self.conn, data); end); |