Software /
code /
verse
Comparison
client.lua @ 400:0db9cb909cf1
client, component: Fix logging of invalid XML
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 09 Feb 2016 23:39:31 +0000 |
parent | 364:69fc23b44819 |
child | 411:db462d4feb44 |
comparison
equal
deleted
inserted
replaced
399:82ad158714e5 | 400:0db9cb909cf1 |
---|---|
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); |