mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
merge r2984, r2985, r3000:
XSLT filter fixes: *) preserve XML wellFormed field before freeing memory *) fix libxml2 error message
This commit is contained in:
parent
fbee171114
commit
e018897a78
@ -194,7 +194,7 @@ ngx_module_t ngx_http_xslt_filter_module = {
|
|||||||
NULL, /* init process */
|
NULL, /* init process */
|
||||||
NULL, /* init thread */
|
NULL, /* init thread */
|
||||||
NULL, /* exit thread */
|
NULL, /* exit thread */
|
||||||
ngx_http_xslt_filter_exit, /* exit process */
|
ngx_http_xslt_filter_exit, /* exit process */
|
||||||
ngx_http_xslt_filter_exit, /* exit master */
|
ngx_http_xslt_filter_exit, /* exit master */
|
||||||
NGX_MODULE_V1_PADDING
|
NGX_MODULE_V1_PADDING
|
||||||
};
|
};
|
||||||
@ -247,6 +247,7 @@ ngx_http_xslt_header_filter(ngx_http_request_t *r)
|
|||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||||
{
|
{
|
||||||
|
int wellFormed;
|
||||||
ngx_chain_t *cl;
|
ngx_chain_t *cl;
|
||||||
ngx_http_xslt_filter_ctx_t *ctx;
|
ngx_http_xslt_filter_ctx_t *ctx;
|
||||||
|
|
||||||
@ -288,9 +289,11 @@ ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||||||
ctx->doc->extSubset = NULL;
|
ctx->doc->extSubset = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wellFormed = ctx->ctxt->wellFormed;
|
||||||
|
|
||||||
xmlFreeParserCtxt(ctx->ctxt);
|
xmlFreeParserCtxt(ctx->ctxt);
|
||||||
|
|
||||||
if (ctx->ctxt->wellFormed) {
|
if (wellFormed) {
|
||||||
return ngx_http_xslt_send(r, ctx,
|
return ngx_http_xslt_send(r, ctx,
|
||||||
ngx_http_xslt_apply_stylesheet(r, ctx));
|
ngx_http_xslt_apply_stylesheet(r, ctx));
|
||||||
}
|
}
|
||||||
@ -717,7 +720,7 @@ ngx_http_xslt_sax_error(void *data, const char *msg, ...)
|
|||||||
while (--n && (buf[n] == CR || buf[n] == LF)) { /* void */ }
|
while (--n && (buf[n] == CR || buf[n] == LF)) { /* void */ }
|
||||||
|
|
||||||
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
|
||||||
"libxml2 error: \"%*s\"", n, buf);
|
"libxml2 error: \"%*s\"", n + 1, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user