diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-07-11 11:57:42 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-07-11 11:57:42 +0100 |
commit | 8402f5a2bfc510fdb14e5d4df169cf084f6f2ab9 (patch) | |
tree | ef54536853a0b8a93b9a17cada75c3ba768e2528 /util/xmppstream.lua | |
parent | 43f84c08dac352ad5a37232a2a5d4459911da680 (diff) | |
download | prosody-8402f5a2bfc510fdb14e5d4df169cf084f6f2ab9.tar.gz prosody-8402f5a2bfc510fdb14e5d4df169cf084f6f2ab9.zip |
util.xmppstream: Perfom validation of XML declaration parameters
Diffstat (limited to 'util/xmppstream.lua')
-rw-r--r-- | util/xmppstream.lua | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua index 8c7851a5..f245afbf 100644 --- a/util/xmppstream.lua +++ b/util/xmppstream.lua @@ -130,16 +130,7 @@ local function new_sax_handlers(session, stream_callbacks, cb_handleprogress) 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 @@ local function new_sax_handlers(session, stream_callbacks, cb_handleprogress) 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 |