Software /
code /
prosody
Comparison
util/xmppstream.lua @ 9020:19e51d8f8947
util.xmppstream: Perfom validation of XML declaration parameters
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 11 Jul 2018 11:57:42 +0100 |
parent | 8555:4f0f5b49bb03 |
child | 9071:db61e33bbd41 |
comparison
equal
deleted
inserted
replaced
9019:d780c10709c1 | 9020:19e51d8f8947 |
---|---|
128 stanza = setmetatable({ name = name, attr = attr, tags = {} }, stanza_mt); | 128 stanza = setmetatable({ name = name, attr = attr, tags = {} }, stanza_mt); |
129 t_insert(oldstanza, stanza); | 129 t_insert(oldstanza, stanza); |
130 t_insert(oldstanza.tags, stanza); | 130 t_insert(oldstanza.tags, stanza); |
131 end | 131 end |
132 end | 132 end |
133 if lxp_supports_xmldecl then | 133 |
134 function xml_handlers:XmlDecl(version, encoding, standalone) | |
135 session.xml_version = version; | |
136 session.xml_encoding = encoding; | |
137 session.xml_standalone = standalone; | |
138 if lxp_supports_bytecount then | |
139 cb_handleprogress(self:getcurrentbytecount()); | |
140 end | |
141 end | |
142 end | |
143 function xml_handlers:StartCdataSection() | 134 function xml_handlers:StartCdataSection() |
144 if lxp_supports_bytecount then | 135 if lxp_supports_bytecount then |
145 if stanza then | 136 if stanza then |
146 stanza_size = stanza_size + self:getcurrentbytecount(); | 137 stanza_size = stanza_size + self:getcurrentbytecount(); |
147 else | 138 else |
208 if not parser.stop or not parser:stop() then | 199 if not parser.stop or not parser:stop() then |
209 error("Failed to abort parsing"); | 200 error("Failed to abort parsing"); |
210 end | 201 end |
211 end | 202 end |
212 | 203 |
204 if lxp_supports_xmldecl then | |
205 function xml_handlers:XmlDecl(version, encoding, standalone) | |
206 if lxp_supports_bytecount then | |
207 cb_handleprogress(self:getcurrentbytecount()); | |
208 end | |
209 if (encoding and encoding:lower() ~= "utf-8") | |
210 or (standalone == "no") | |
211 or (version and version ~= "1.0") then | |
212 return restricted_handler(self); | |
213 end | |
214 end | |
215 end | |
213 if lxp_supports_doctype then | 216 if lxp_supports_doctype then |
214 xml_handlers.StartDoctypeDecl = restricted_handler; | 217 xml_handlers.StartDoctypeDecl = restricted_handler; |
215 end | 218 end |
216 xml_handlers.Comment = restricted_handler; | 219 xml_handlers.Comment = restricted_handler; |
217 xml_handlers.ProcessingInstruction = restricted_handler; | 220 xml_handlers.ProcessingInstruction = restricted_handler; |