Merge 0.6->0.7
authorMatthew Wild <mwild1@gmail.com>
Thu, 2 Jun 2011 14:23:58 +0000 (15:23 +0100)
committerMatthew Wild <mwild1@gmail.com>
Thu, 2 Jun 2011 14:23:58 +0000 (15:23 +0100)
1  2 
core/xmlhandlers.lua

index eb7e3ba1796648249442ae7af04e2c6695447a0f,10f02d0bd67f0ab97a25870c5c83b02d97b22672..d86ffe7de60947700c473a0cd80da37d1d1d240c
@@@ -143,21 -134,32 +134,35 @@@ function init_xmlhandlers(session, stre
                        else
                                stanza:up();
                        end
-               end
-               local function restricted_handler(parser)
-                       cb_error(session, "parse-error", "restricted-xml", "Restricted XML, see RFC 6120 section 11.1.");
-                       if not parser:stop() then
-                               error("Failed to abort parsing");
+               else
+                       if tagname == stream_tag then
+                               if cb_streamclosed then
+                                       cb_streamclosed(session);
+                               end
+                       else
+                               local curr_ns,name = tagname:match(ns_pattern);
+                               if name == "" then
+                                       curr_ns, name = "", curr_ns;
+                               end
+                               cb_error(session, "parse-error", "unexpected-element-close", name);
                        end
+                       stanza, chardata = nil, {};
                end
-               
-               if lxp_supports_doctype then
-                       xml_handlers.StartDoctypeDecl = restricted_handler;
+       end
 -      local function restricted_handler()
++      local function restricted_handler(parser)
+               cb_error(session, "parse-error", "restricted-xml", "Restricted XML, see RFC 6120 section 11.1.");
++              if not parser:stop() then
++                      error("Failed to abort parsing");
 +              end
-               xml_handlers.Comment = restricted_handler;
-               xml_handlers.ProcessingInstruction = restricted_handler;
-       
+       end
+       if lxp_supports_doctype then
+               xml_handlers.StartDoctypeDecl = restricted_handler;
+       end
+       xml_handlers.Comment = restricted_handler;
+       xml_handlers.ProcessingInstruction = restricted_handler;
        return xml_handlers;
  end