Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/util/xmppstream.lua Wed Jul 11 12:05:06 2018 +0200 +++ b/util/xmppstream.lua Wed Jul 11 11:57:42 2018 +0100 @@ -130,16 +130,7 @@ t_insert(oldstanza.tags, stanza); end end - if lxp_supports_xmldecl then - function xml_handlers:XmlDecl(version, encoding, standalone) - session.xml_version = version; - session.xml_encoding = encoding; - session.xml_standalone = standalone; - if lxp_supports_bytecount then - cb_handleprogress(self:getcurrentbytecount()); - end - end - end + function xml_handlers:StartCdataSection() if lxp_supports_bytecount then if stanza then @@ -210,6 +201,18 @@ end end + if lxp_supports_xmldecl then + function xml_handlers:XmlDecl(version, encoding, standalone) + if lxp_supports_bytecount then + cb_handleprogress(self:getcurrentbytecount()); + end + if (encoding and encoding:lower() ~= "utf-8") + or (standalone == "no") + or (version and version ~= "1.0") then + return restricted_handler(self); + end + end + end if lxp_supports_doctype then xml_handlers.StartDoctypeDecl = restricted_handler; end