Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/http/ngx_http_variables.c
- ===================================================================
- --- src/http/ngx_http_variables.c (revision 4524)
- +++ src/http/ngx_http_variables.c (working copy)
- @@ -427,7 +427,7 @@
- v = &r->variables[index];
- - if (v->valid) {
- + if (v->valid || v->not_found) {
- if (!v->no_cacheable) {
- return v;
- }
- Index: src/http/modules/ngx_http_xslt_filter_module.c
- ===================================================================
- --- src/http/modules/ngx_http_xslt_filter_module.c (revision 4524)
- +++ src/http/modules/ngx_http_xslt_filter_module.c (working copy)
- @@ -9,6 +9,7 @@
- #include <ngx_http.h>
- #include <libxml/parser.h>
- +#include <libxml/HTMLparser.h>
- #include <libxml/tree.h>
- #include <libxslt/xslt.h>
- #include <libxslt/xsltInternals.h>
- @@ -19,7 +20,6 @@
- #include <libexslt/exslt.h>
- #endif
- -
- #ifndef NGX_HTTP_XSLT_REUSE_DTD
- #define NGX_HTTP_XSLT_REUSE_DTD 1
- #endif
- @@ -48,6 +48,8 @@
- ngx_array_t sheets; /* ngx_http_xslt_sheet_t */
- ngx_hash_t types;
- ngx_array_t *types_keys;
- + ngx_flag_t html_parser;
- + ngx_flag_t parse_recover;
- } ngx_http_xslt_filter_loc_conf_t;
- @@ -57,6 +59,8 @@
- xmlSAXHandler *sax;
- ngx_http_request_t *request;
- ngx_array_t params;
- + ngx_flag_t html_parser;
- + ngx_flag_t parse_recover;
- ngx_uint_t done; /* unsigned done:1; */
- } ngx_http_xslt_filter_ctx_t;
- @@ -68,49 +72,8 @@
- ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b);
- -static void ngx_http_xslt_sax_start_document(void *data);
- -static void ngx_http_xslt_sax_end_document(void *data);
- -static void ngx_http_xslt_sax_internal_subset(void *data, const xmlChar *name,
- - const xmlChar *externalId, const xmlChar *systemId);
- static void ngx_http_xslt_sax_external_subset(void *data, const xmlChar *name,
- const xmlChar *externalId, const xmlChar *systemId);
- -static void ngx_http_xslt_sax_entity_decl(void *data, const xmlChar *name,
- - int type, const xmlChar *publicId, const xmlChar *systemId,
- - xmlChar *content);
- -static void ngx_http_xslt_sax_attribute_decl(void *data, const xmlChar *elem,
- - const xmlChar *fullname, int type, int def, const xmlChar *defaultValue,
- - xmlEnumerationPtr tree);
- -static void ngx_http_xslt_sax_element_decl(void *data, const xmlChar * name,
- - int type, xmlElementContentPtr content);
- -static void ngx_http_xslt_sax_notation_decl(void *data, const xmlChar *name,
- - const xmlChar *publicId, const xmlChar *systemId);
- -static void ngx_http_xslt_sax_unparsed_entity_decl(void *data,
- - const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId,
- - const xmlChar *notationName);
- -static void ngx_http_xslt_sax_start_element(void *data,
- - const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI,
- - int nb_namespaces, const xmlChar **namespaces, int nb_attributes,
- - int nb_defaulted, const xmlChar **attributes);
- -static void ngx_http_xslt_sax_end_element(void *data,
- - const xmlChar * localname ATTRIBUTE_UNUSED,
- - const xmlChar * prefix ATTRIBUTE_UNUSED,
- - const xmlChar * URI ATTRIBUTE_UNUSED);
- -static void ngx_http_xslt_sax_characters(void *data, const xmlChar *p, int len);
- -static void ngx_http_xslt_sax_cdata_block(void *data, const xmlChar *p,
- - int len);
- -static xmlEntityPtr ngx_http_xslt_sax_get_entity(void *data,
- - const xmlChar *name);
- -static xmlEntityPtr ngx_http_xslt_sax_get_parameter_entity(void *data,
- - const xmlChar *name);
- -static xmlParserInputPtr ngx_http_xslt_sax_resolve_entity(void *data,
- - const xmlChar *publicId, const xmlChar *systemId);
- -static void ngx_http_xslt_sax_reference(void *data, const xmlChar *name);
- -static void ngx_http_xslt_sax_comment(void *data, const xmlChar *value);
- -static void ngx_http_xslt_sax_processing_instruction(void *data,
- - const xmlChar *target, const xmlChar *pidata);
- -static int ngx_http_xslt_sax_is_standalone(void *data);
- -static int ngx_http_xslt_sax_has_internal_subset(void *data);
- -static int ngx_http_xslt_sax_has_external_subset(void *data);
- static void ngx_cdecl ngx_http_xslt_sax_error(void *data, const char *msg, ...);
- @@ -137,7 +100,7 @@
- ngx_str_t ngx_http_xslt_default_types[] = {
- - ngx_string("text/xml"),
- + ngx_string("example/workaround"),
- ngx_null_string
- };
- @@ -165,6 +128,20 @@
- offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys),
- &ngx_http_xslt_default_types[0] },
- + { ngx_string("xslt_html_parser"),
- + NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
- + ngx_conf_set_flag_slot,
- + NGX_HTTP_LOC_CONF_OFFSET,
- + offsetof(ngx_http_xslt_filter_loc_conf_t, html_parser),
- + NULL },
- +
- + { ngx_string("xslt_parse_recover"),
- + NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
- + ngx_conf_set_flag_slot,
- + NGX_HTTP_LOC_CONF_OFFSET,
- + offsetof(ngx_http_xslt_filter_loc_conf_t, parse_recover),
- + NULL },
- +
- ngx_null_command
- };
- @@ -240,6 +217,9 @@
- r->main_filter_need_in_memory = 1;
- + ctx->html_parser = conf->html_parser;
- + ctx->parse_recover = conf->parse_recover;
- +
- return NGX_OK;
- }
- @@ -247,7 +227,6 @@
- static ngx_int_t
- ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
- {
- - int wellFormed;
- ngx_chain_t *cl;
- ngx_http_xslt_filter_ctx_t *ctx;
- @@ -264,6 +243,10 @@
- return ngx_http_next_body_filter(r, in);
- }
- + if (r->headers_out.content_length_n == 0) {
- + return ngx_http_xslt_send(r, ctx, in->buf);
- + }
- +
- for (cl = in; cl; cl = cl->next) {
- if (ngx_http_xslt_add_chunk(r, ctx, cl->buf) != NGX_OK) {
- @@ -276,7 +259,11 @@
- xmlFreeDoc(ctx->ctxt->myDoc);
- }
- - xmlFreeParserCtxt(ctx->ctxt);
- + if (ctx->html_parser) {
- + htmlFreeParserCtxt(ctx->ctxt);
- + } else {
- + xmlFreeParserCtxt(ctx->ctxt);
- + }
- return ngx_http_xslt_send(r, ctx, NULL);
- }
- @@ -289,11 +276,13 @@
- ctx->doc->extSubset = NULL;
- #endif
- - wellFormed = ctx->ctxt->wellFormed;
- + if (ctx->html_parser) {
- + htmlFreeParserCtxt(ctx->ctxt);
- + } else {
- + xmlFreeParserCtxt(ctx->ctxt);
- + }
- - xmlFreeParserCtxt(ctx->ctxt);
- -
- - if (wellFormed) {
- + if (ctx->parse_recover || ctx->ctxt->wellFormed) {
- return ngx_http_xslt_send(r, ctx,
- ngx_http_xslt_apply_stylesheet(r, ctx));
- }
- @@ -371,12 +360,21 @@
- xmlParserCtxtPtr ctxt;
- if (ctx->ctxt == NULL) {
- -
- - ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
- - if (ctxt == NULL) {
- - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- - "xmlCreatePushParserCtxt() failed");
- - return NGX_ERROR;
- +
- + if (ctx->html_parser) {
- + ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL, XML_CHAR_ENCODING_UTF8);
- + if (ctxt == NULL) {
- + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- + "htmlCreatePushParserCtxt() failed");
- + return NGX_ERROR;
- + }
- + } else {
- + ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
- + if (ctxt == NULL) {
- + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- + "xmlCreatePushParserCtxt() failed");
- + return NGX_ERROR;
- + }
- }
- ctx->sax = ngx_palloc(r->pool, sizeof(xmlSAXHandler));
- @@ -388,96 +386,69 @@
- ngx_memcpy(ctx->sax, sax, sizeof(xmlSAXHandler));
- - sax->startDocument = ngx_http_xslt_sax_start_document;
- - sax->endDocument = ngx_http_xslt_sax_end_document;
- -
- - sax->internalSubset = ngx_http_xslt_sax_internal_subset;
- sax->externalSubset = ngx_http_xslt_sax_external_subset;
- - sax->entityDecl = ngx_http_xslt_sax_entity_decl;
- - sax->attributeDecl = ngx_http_xslt_sax_attribute_decl;
- - sax->elementDecl = ngx_http_xslt_sax_element_decl;
- - sax->notationDecl = ngx_http_xslt_sax_notation_decl;
- - sax->unparsedEntityDecl = ngx_http_xslt_sax_unparsed_entity_decl;
- sax->setDocumentLocator = NULL;
- -
- - sax->startElementNs = ngx_http_xslt_sax_start_element;
- - sax->endElementNs = ngx_http_xslt_sax_end_element;
- -
- - sax->characters = ngx_http_xslt_sax_characters;
- - sax->ignorableWhitespace = ngx_http_xslt_sax_characters;
- - sax->cdataBlock = ngx_http_xslt_sax_cdata_block;
- - sax->getEntity = ngx_http_xslt_sax_get_entity;
- - sax->resolveEntity = ngx_http_xslt_sax_resolve_entity;
- - sax->getParameterEntity = ngx_http_xslt_sax_get_parameter_entity;
- - sax->reference = ngx_http_xslt_sax_reference;
- - sax->comment = ngx_http_xslt_sax_comment;
- - sax->processingInstruction = ngx_http_xslt_sax_processing_instruction;
- -
- - sax->isStandalone = ngx_http_xslt_sax_is_standalone;
- - sax->hasInternalSubset = ngx_http_xslt_sax_has_internal_subset;
- - sax->hasExternalSubset = ngx_http_xslt_sax_has_external_subset;
- -
- sax->warning = NULL;
- sax->error = ngx_http_xslt_sax_error;
- sax->fatalError = ngx_http_xslt_sax_error;
- - ctxt->userData = ctx;
- + sax->_private = ctx;
- ctxt->replaceEntities = 1;
- ctxt->loadsubset = 1;
- ctx->ctxt = ctxt;
- ctx->request = r;
- +
- + if (ctx->html_parser) {
- + if (ctx->parse_recover) {
- + htmlCtxtUseOptions(ctxt, HTML_PARSE_RECOVER | HTML_PARSE_NOERROR | HTML_PARSE_NOWARNING | HTML_PARSE_NONET | HTML_PARSE_COMPACT);
- + } else {
- + htmlCtxtUseOptions(ctxt, HTML_PARSE_NONET | HTML_PARSE_COMPACT);
- + }
- + } else {
- + if (ctx->parse_recover) {
- + xmlCtxtUseOptions(ctxt, XML_PARSE_RECOVER | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
- + }
- + }
- }
- - err = xmlParseChunk(ctx->ctxt, (char *) b->pos, (int) (b->last - b->pos),
- - (b->last_buf) || (b->last_in_chain));
- + if (ctx->html_parser) {
- + err = htmlParseChunk(ctx->ctxt, (char *) b->pos, (int) (b->last - b->pos),
- + (b->last_buf) || (b->last_in_chain));
- - if (err == 0) {
- - b->pos = b->last;
- - return NGX_OK;
- - }
- + if (ctx->parse_recover || err == 0) {
- + b->pos = b->last;
- + return NGX_OK;
- + }
- - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- - "xmlParseChunk() failed, error:%d", err);
- + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- + "htmlParseChunk() failed, error:%d", err);
- - return NGX_ERROR;
- -}
- + return NGX_ERROR;
- + } else {
- + err = xmlParseChunk(ctx->ctxt, (char *) b->pos, (int) (b->last - b->pos),
- + (b->last_buf) || (b->last_in_chain));
- + if (ctx->parse_recover || err == 0) {
- + b->pos = b->last;
- + return NGX_OK;
- + }
- -static void
- -ngx_http_xslt_sax_start_document(void *data)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- + "xmlParseChunk() failed, error:%d", err);
- - ctx->sax->startDocument(ctx->ctxt);
- + return NGX_ERROR;
- + }
- }
- static void
- -ngx_http_xslt_sax_end_document(void *data)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->endDocument(ctx->ctxt);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_internal_subset(void *data, const xmlChar *name,
- - const xmlChar *externalId, const xmlChar *systemId)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->internalSubset(ctx->ctxt, name, externalId, systemId);
- -}
- -
- -
- -static void
- ngx_http_xslt_sax_external_subset(void *data, const xmlChar *name,
- const xmlChar *externalId, const xmlChar *systemId)
- {
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data;
- + ngx_http_xslt_filter_ctx_t *ctx = ctxt->sax->_private;
- xmlDocPtr doc;
- xmlDtdPtr dtd;
- @@ -522,190 +493,11 @@
- }
- -static void
- -ngx_http_xslt_sax_entity_decl(void *data, const xmlChar *name, int type,
- - const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->entityDecl(ctx->ctxt, name, type, publicId, systemId, content);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_attribute_decl(void *data, const xmlChar *elem,
- - const xmlChar *fullname, int type, int def, const xmlChar *defaultValue,
- - xmlEnumerationPtr tree)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->attributeDecl(ctx->ctxt, elem, fullname, type, def, defaultValue,
- - tree);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_element_decl(void *data, const xmlChar * name, int type,
- - xmlElementContentPtr content)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->elementDecl(ctx->ctxt, name, type, content);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_notation_decl(void *data, const xmlChar *name,
- - const xmlChar *publicId, const xmlChar *systemId)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->notationDecl(ctx->ctxt, name, publicId, systemId);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_unparsed_entity_decl(void *data, const xmlChar *name,
- - const xmlChar *publicId, const xmlChar *systemId,
- - const xmlChar *notationName)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->unparsedEntityDecl(ctx->ctxt, name, publicId, systemId,
- - notationName);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_start_element(void *data, const xmlChar *localname,
- - const xmlChar *prefix, const xmlChar *URI, int nb_namespaces,
- - const xmlChar **namespaces, int nb_attributes, int nb_defaulted,
- - const xmlChar **attributes)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->startElementNs(ctx->ctxt, localname, prefix, URI, nb_namespaces,
- - namespaces, nb_attributes, nb_defaulted, attributes);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_end_element(void *data,
- - const xmlChar * localname ATTRIBUTE_UNUSED,
- - const xmlChar * prefix ATTRIBUTE_UNUSED,
- - const xmlChar * URI ATTRIBUTE_UNUSED)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->endElementNs(ctx->ctxt, localname, prefix, URI);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_characters(void *data, const xmlChar *p, int len)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->characters(ctx->ctxt, p, len);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_cdata_block(void *data, const xmlChar *p, int len)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->cdataBlock(ctx->ctxt, p, len);
- -}
- -
- -
- -static xmlEntityPtr
- -ngx_http_xslt_sax_get_entity(void *data, const xmlChar *name)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - return ctx->sax->getEntity(ctx->ctxt, name);
- -}
- -
- -
- -static xmlEntityPtr
- -ngx_http_xslt_sax_get_parameter_entity(void *data, const xmlChar *name)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - return ctx->sax->getParameterEntity(ctx->ctxt, name);
- -}
- -
- -
- -static xmlParserInputPtr
- -ngx_http_xslt_sax_resolve_entity(void *data, const xmlChar *publicId,
- - const xmlChar *systemId)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - return ctx->sax->resolveEntity(ctx->ctxt, publicId, systemId);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_reference(void *data, const xmlChar *name)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->reference(ctx->ctxt, name);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_comment(void *data, const xmlChar *value)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->comment(ctx->ctxt, value);
- -}
- -
- -
- -static void
- -ngx_http_xslt_sax_processing_instruction(void *data, const xmlChar *target,
- - const xmlChar *pidata)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - ctx->sax->processingInstruction(ctx->ctxt, target, pidata);
- -}
- -
- -
- -static int
- -ngx_http_xslt_sax_is_standalone(void *data)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - return ctx->sax->isStandalone(ctx->ctxt);
- -}
- -
- -
- -static int
- -ngx_http_xslt_sax_has_internal_subset(void *data)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - return ctx->sax->hasInternalSubset(ctx->ctxt);
- -}
- -
- -
- -static int
- -ngx_http_xslt_sax_has_external_subset(void *data)
- -{
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- -
- - return ctx->sax->hasExternalSubset(ctx->ctxt);
- -}
- -
- -
- static void ngx_cdecl
- ngx_http_xslt_sax_error(void *data, const char *msg, ...)
- {
- - ngx_http_xslt_filter_ctx_t *ctx = data;
- + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data;
- + ngx_http_xslt_filter_ctx_t *ctx = ctxt->sax->_private;
- size_t n;
- va_list args;
- @@ -869,60 +661,49 @@
- "xslt filter param: \"%s\"", string.data);
- p = string.data;
- - last = string.data + string.len - 1;
- + last = string.data + string.len;
- - while (p && *p) {
- + value = p;
- + p = (u_char *) ngx_strchr(p, '=');
- + if (p == NULL) {
- + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- + "invalid libxslt parameter \"%s\"", value);
- + return NGX_ERROR;
- + }
- + *p++ = '\0';
- - value = p;
- - p = (u_char *) ngx_strchr(p, '=');
- - if (p == NULL) {
- - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- - "invalid libxslt parameter \"%s\"", value);
- - return NGX_ERROR;
- - }
- - *p++ = '\0';
- + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- + "xslt filter param name: \"%s\"", value);
- - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- - "xslt filter param name: \"%s\"", value);
- + s = ngx_array_push(&ctx->params);
- + if (s == NULL) {
- + return NGX_ERROR;
- + }
- - s = ngx_array_push(&ctx->params);
- - if (s == NULL) {
- - return NGX_ERROR;
- - }
- + *s = value;
- - *s = value;
- + value = p;
- + len = last - value;
- - value = p;
- - p = (u_char *) ngx_strchr(p, ':');
- + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- + "xslt filter param value: \"%s\"", value);
- - if (p) {
- - len = p - value;
- - *p++ = '\0';
- + dst = value;
- + src = value;
- - } else {
- - len = last - value;
- - }
- + ngx_unescape_uri(&dst, &src, len, 0);
- - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- - "xslt filter param value: \"%s\"", value);
- + *dst = '\0';
- - dst = value;
- - src = value;
- + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- + "xslt filter param unescaped: \"%s\"", value);
- - ngx_unescape_uri(&dst, &src, len, 0);
- -
- - *dst = '\0';
- -
- - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- - "xslt filter param unescaped: \"%s\"", value);
- -
- - s = ngx_array_push(&ctx->params);
- - if (s == NULL) {
- - return NGX_ERROR;
- - }
- -
- - *s = value;
- + s = ngx_array_push(&ctx->params);
- + if (s == NULL) {
- + return NGX_ERROR;
- }
- +
- + *s = value;
- }
- s = ngx_array_push(&ctx->params);
- @@ -1210,8 +991,13 @@
- * conf->sheets = { NULL };
- * conf->types = { NULL };
- * conf->types_keys = NULL;
- + * conf->html_parser = NULL;
- + * conf->parse_recover = NULL;
- */
- + conf->html_parser = NGX_CONF_UNSET;
- + conf->parse_recover = NGX_CONF_UNSET;
- +
- return conf;
- }
- @@ -1238,6 +1024,9 @@
- return NGX_CONF_ERROR;
- }
- + ngx_conf_merge_value(conf->html_parser, prev->html_parser, 0);
- + ngx_conf_merge_value(conf->parse_recover, prev->parse_recover, 1);
- +
- return NGX_CONF_OK;
- }
- Index: auto/options
- ===================================================================
- --- auto/options (revision 4524)
- +++ auto/options (working copy)
- @@ -125,6 +125,9 @@
- NGX_PERL=perl
- USE_LIBXSLT=NO
- +LIBXML2=NONE
- +LIBXSLT=NONE
- +
- USE_LIBGD=NO
- NGX_GOOGLE_PERFTOOLS=NO
- @@ -262,6 +265,9 @@
- --with-zlib-opt=*) ZLIB_OPT="$value" ;;
- --with-zlib-asm=*) ZLIB_ASM="$value" ;;
- + --with-libxml2=*) LIBXML2="$value" ;;
- + --with-libxslt=*) LIBXSLT="$value" ;;
- +
- --test-build-devpoll) NGX_TEST_BUILD_DEVPOLL=YES ;;
- --test-build-eventport) NGX_TEST_BUILD_EVENTPORT=YES ;;
- --test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;;
- @@ -394,6 +400,9 @@
- for specified CPU, the valid values:
- pentium, pentiumpro
- + --with-libxml2=DIR set path to libxml2 library sources
- + --with-libxslt=DIR set path to libxslt library sources
- +
- --with-openssl=DIR set path to OpenSSL library sources
- --with-openssl-opt=OPTIONS set additional options for OpenSSL building
- Index: auto/lib/libxslt/conf
- ===================================================================
- --- auto/lib/libxslt/conf (revision 4524)
- +++ auto/lib/libxslt/conf (working copy)
- @@ -13,6 +13,23 @@
- #include <libxslt/xsltutils.h>"
- ngx_feature_path="/usr/include/libxml2"
- ngx_feature_libs="-lxml2 -lxslt"
- + if [ "$LIBXML2" != NONE ]; then
- + ngx_feature_path="$LIBXML2/include/libxml2"
- + if [ $NGX_RPATH = YES ]; then
- + ngx_feature_libs="-R$LIBXML2/lib -L$LIBXML2/lib $ngx_feature_libs"
- + else
- + ngx_feature_libs="-L$LIBXML2/lib $ngx_feature_libs"
- + fi
- + fi
- + if [ "$LIBXSLT" != NONE ]; then
- + ngx_feature_path="$LIBXSLT/include $ngx_feature_path"
- + if [ $NGX_RPATH = YES ]; then
- + ngx_feature_libs="-R$LIBXSLT/lib -L$LIBXSLT/lib $ngx_feature_libs"
- + else
- + ngx_feature_libs="-L$LIBXSLT/lib $ngx_feature_libs"
- + fi
- + fi
- +
- ngx_feature_test="xmlParserCtxtPtr ctxt = NULL;
- xsltStylesheetPtr sheet = NULL;
- xmlDocPtr doc;
- @@ -94,13 +111,29 @@
- ngx_feature_name=NGX_HAVE_EXSLT
- ngx_feature_run=no
- ngx_feature_incs="#include <libexslt/exslt.h>"
- - ngx_feature_path="/usr/include/libxml2"
- - ngx_feature_libs="-lexslt"
- + ngx_feature_libs="-lexslt $ngx_feature_libs"
- ngx_feature_test="exsltRegisterAll();"
- . auto/feature
- if [ $ngx_found = no ]; then
- + # /usr
- +
- + ngx_feature="libexslt in /usr/"
- + ngx_feature_path="/usr/libxml2 /usr/include"
- +
- + if [ $NGX_RPATH = YES ]; then
- + ngx_feature_libs="-R/usr/lib -L/usr/lib -lexslt"
- + else
- + ngx_feature_libs="-L/usr/lib -lexslt"
- + fi
- +
- + . auto/feature
- +fi
- +
- +
- +if [ $ngx_found = no ]; then
- +
- # FreeBSD port
- ngx_feature="libexslt in /usr/local/"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement