Mercurial > prosody-hg
comparison util/xmppstream.lua @ 6052:ce3244c084f9
util.xmppstream: Disable LuaExpat's buffering (if possible)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 02 Apr 2014 11:05:41 +0100 |
| parents | 1107d66d2ab2 |
| children | 2f93a04564b2 |
comparison
equal
deleted
inserted
replaced
| 6051:46b4af3cf5ce | 6052:ce3244c084f9 |
|---|---|
| 155 end | 155 end |
| 156 end | 156 end |
| 157 function xml_handlers:CharacterData(data) | 157 function xml_handlers:CharacterData(data) |
| 158 if stanza then | 158 if stanza then |
| 159 if lxp_supports_bytecount then | 159 if lxp_supports_bytecount then |
| 160 stanza_size = stanza_size + #data --self:getcurrentbytecount(); | 160 stanza_size = stanza_size + self:getcurrentbytecount(); |
| 161 end | 161 end |
| 162 t_insert(chardata, data); | 162 t_insert(chardata, data); |
| 163 elseif lxp_supports_bytecount then | 163 elseif lxp_supports_bytecount then |
| 164 cb_handleprogress(#data--[[self:getcurrentbytecount()]]); | 164 cb_handleprogress(self:getcurrentbytecount()); |
| 165 end | 165 end |
| 166 end | 166 end |
| 167 function xml_handlers:EndElement(tagname) | 167 function xml_handlers:EndElement(tagname) |
| 168 if lxp_supports_bytecount then | 168 if lxp_supports_bytecount then |
| 169 stanza_size = stanza_size + self:getcurrentbytecount() | 169 stanza_size = stanza_size + self:getcurrentbytecount() |
| 236 elseif stanza_size_limit then | 236 elseif stanza_size_limit then |
| 237 error("Stanza size limits are not supported on this version of LuaExpat") | 237 error("Stanza size limits are not supported on this version of LuaExpat") |
| 238 end | 238 end |
| 239 | 239 |
| 240 local handlers, meta = new_sax_handlers(session, stream_callbacks, handle_progress); | 240 local handlers, meta = new_sax_handlers(session, stream_callbacks, handle_progress); |
| 241 local parser = new_parser(handlers, ns_separator); | 241 local parser = new_parser(handlers, ns_separator, false); |
| 242 local parse = parser.parse; | 242 local parse = parser.parse; |
| 243 | 243 |
| 244 return { | 244 return { |
| 245 reset = function () | 245 reset = function () |
| 246 parser = new_parser(handlers, ns_separator); | 246 parser = new_parser(handlers, ns_separator); |
