[njs] XML: fixed tests with libxml2 2.13 and later.

noreply at nginx.com noreply at nginx.com
Thu Nov 7 19:05:02 UTC 2024


details:   https://github.com/nginx/njs/commit/597b1fd1fa34999ec47bbd574da35491f56b8893
branches:  master
commit:    597b1fd1fa34999ec47bbd574da35491f56b8893
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed, 6 Nov 2024 22:08:21 -0800
description:
XML: fixed tests with libxml2 2.13 and later.

This fixes #812 issue on Github.

---
 external/njs_xml_module.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/external/njs_xml_module.c b/external/njs_xml_module.c
index 86c896c0..d9f3bbb5 100644
--- a/external/njs_xml_module.c
+++ b/external/njs_xml_module.c
@@ -1275,17 +1275,13 @@ njs_xml_node_tags_handler(njs_vm_t *vm, xmlNode *current, njs_str_t *name,
 
     /* set or delete. */
 
-    copy = xmlDocCopyNode(current, current->doc, 1);
+    copy = xmlDocCopyNode(current, current->doc,
+                          2 /* copy properties and namespaces */);
     if (njs_slow_path(copy == NULL)) {
         njs_vm_internal_error(vm, "xmlDocCopyNode() failed");
         return NJS_ERROR;
     }
 
-    if (copy->children != NULL) {
-        xmlFreeNodeList(copy->children);
-        copy->children = NULL;
-    }
-
     if (retval == NULL) {
         /* delete. */
         return njs_xml_replace_node(vm, current, copy);


More information about the nginx-devel mailing list