Mercurial > prosody-hg
comparison util/xmppstream.lua @ 7240:bf8aa0d1951c
util.xmppstream: Remove namespace tracking, it's broken as implemented
The code fails to handle namespaces on the initial opening tag (when 'stanza' is nil). Fixing this
seems not worth the effort for a feature that is not being used.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 05 Mar 2016 23:37:56 +0000 |
| parents | 30c96a5db360 |
| children | e5d00bf4a4d5 |
comparison
equal
deleted
inserted
replaced
| 7239:c9af793b2d8f | 7240:bf8aa0d1951c |
|---|---|
| 194 cb_streamclosed(session); | 194 cb_streamclosed(session); |
| 195 end | 195 end |
| 196 end | 196 end |
| 197 end | 197 end |
| 198 | 198 |
| 199 if stream_callbacks.track_namespaces then | |
| 200 local namespaces = {} | |
| 201 function xml_handlers:StartNamespaceDecl(prefix, url) | |
| 202 if prefix ~= nil then | |
| 203 namespaces[prefix] = url | |
| 204 end | |
| 205 end | |
| 206 function xml_handlers:EndNamespaceDecl(prefix) | |
| 207 if prefix ~= nil then | |
| 208 namespaces[prefix] = nil | |
| 209 end | |
| 210 end | |
| 211 local old_startelement = xml_handlers.StartElement | |
| 212 function xml_handlers:StartElement(tagname, attr) | |
| 213 old_startelement(self, tagname, attr) | |
| 214 local n = {} | |
| 215 for prefix, url in pairs(namespaces) do | |
| 216 n[prefix] = url | |
| 217 end | |
| 218 stanza.namespaces = n | |
| 219 end | |
| 220 end | |
| 221 | |
| 222 local function restricted_handler(parser) | 199 local function restricted_handler(parser) |
| 223 cb_error(session, "parse-error", "restricted-xml", "Restricted XML, see RFC 6120 section 11.1."); | 200 cb_error(session, "parse-error", "restricted-xml", "Restricted XML, see RFC 6120 section 11.1."); |
| 224 if not parser.stop or not parser:stop() then | 201 if not parser.stop or not parser:stop() then |
| 225 error("Failed to abort parsing"); | 202 error("Failed to abort parsing"); |
| 226 end | 203 end |
