[PATCH 1 of 4] Set parser options with xmlCtxtUseOptions

Laurence Rowe l at lrowe.co.uk
Wed Mar 21 21:28:31 UTC 2012


# HG changeset patch
# User Laurence Rowe <laurence at lrowe.co.uk>
# Date 1331326885 0
# Node ID 28a1437a8b4492530a24d51b85aca7923627c330
# Parent  aed89f1bb357e289086f9a768e2e9958c4076b7c
Set parser options with xmlCtxtUseOptions

In the current version of libxml2, loadsubset is a bit field. The
previous value of 1 does not match any of the loadsubset bit field
options (XML_DETECT_IDS=2, XML_COMPLETE_ATTRS=4, XML_SKIP_IDS=8) but
from reading the source, XML_DETECT_IDS is not tested for directly in
any relevant files, with SAX2.c using the test (ctxt->loadsubset !=
0). The loadsubset value is set to XML_DETECT_IDS by the
xmlCtxtUseOptions call with XML_PARSE_DTDLOAD.

diff --git a/src/http/modules/ngx_http_xslt_filter_module.c b/src/http/modules/ngx_http_xslt_filter_module.c
--- a/src/http/modules/ngx_http_xslt_filter_module.c
+++ b/src/http/modules/ngx_http_xslt_filter_module.c
@@ -362,15 +362,14 @@
                           "xmlCreatePushParserCtxt() failed");
             return NGX_ERROR;
         }
+        xmlCtxtUseOptions(ctxt, XML_PARSE_NOENT|XML_PARSE_DTDLOAD
+                                               |XML_PARSE_NOWARNING);
 
         ctxt->sax->externalSubset = ngx_http_xslt_sax_external_subset;
         ctxt->sax->setDocumentLocator = NULL;
-        ctxt->sax->warning = NULL;
         ctxt->sax->error = ngx_http_xslt_sax_error;
         ctxt->sax->fatalError = ngx_http_xslt_sax_error;
         ctxt->sax->_private = ctx;
-        ctxt->replaceEntities = 1;
-        ctxt->loadsubset = 1;
 
         ctx->ctxt = ctxt;
         ctx->request = r;



More information about the nginx-devel mailing list