Mercurial > hg > nginx
comparison src/http/modules/ngx_http_xslt_filter_module.c @ 3096:8ba95d7cab37 stable-0.7
merge r2984, r2985, r3000:
XSLT filter fixes:
*) preserve XML wellFormed field before freeing memory
*) fix libxml2 error message
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 07 Sep 2009 10:05:36 +0000 |
parents | 9ef3719c4d8a |
children | 2efa8d2fcde1 |
comparison
equal
deleted
inserted
replaced
3095:e326a69cabc9 | 3096:8ba95d7cab37 |
---|---|
192 NULL, /* init master */ | 192 NULL, /* init master */ |
193 NULL, /* init module */ | 193 NULL, /* init module */ |
194 NULL, /* init process */ | 194 NULL, /* init process */ |
195 NULL, /* init thread */ | 195 NULL, /* init thread */ |
196 NULL, /* exit thread */ | 196 NULL, /* exit thread */ |
197 ngx_http_xslt_filter_exit, /* exit process */ | 197 ngx_http_xslt_filter_exit, /* exit process */ |
198 ngx_http_xslt_filter_exit, /* exit master */ | 198 ngx_http_xslt_filter_exit, /* exit master */ |
199 NGX_MODULE_V1_PADDING | 199 NGX_MODULE_V1_PADDING |
200 }; | 200 }; |
201 | 201 |
202 | 202 |
245 | 245 |
246 | 246 |
247 static ngx_int_t | 247 static ngx_int_t |
248 ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in) | 248 ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in) |
249 { | 249 { |
250 int wellFormed; | |
250 ngx_chain_t *cl; | 251 ngx_chain_t *cl; |
251 ngx_http_xslt_filter_ctx_t *ctx; | 252 ngx_http_xslt_filter_ctx_t *ctx; |
252 | 253 |
253 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 254 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
254 "xslt filter body"); | 255 "xslt filter body"); |
286 | 287 |
287 #if (NGX_HTTP_XSLT_REUSE_DTD) | 288 #if (NGX_HTTP_XSLT_REUSE_DTD) |
288 ctx->doc->extSubset = NULL; | 289 ctx->doc->extSubset = NULL; |
289 #endif | 290 #endif |
290 | 291 |
292 wellFormed = ctx->ctxt->wellFormed; | |
293 | |
291 xmlFreeParserCtxt(ctx->ctxt); | 294 xmlFreeParserCtxt(ctx->ctxt); |
292 | 295 |
293 if (ctx->ctxt->wellFormed) { | 296 if (wellFormed) { |
294 return ngx_http_xslt_send(r, ctx, | 297 return ngx_http_xslt_send(r, ctx, |
295 ngx_http_xslt_apply_stylesheet(r, ctx)); | 298 ngx_http_xslt_apply_stylesheet(r, ctx)); |
296 } | 299 } |
297 | 300 |
298 xmlFreeDoc(ctx->doc); | 301 xmlFreeDoc(ctx->doc); |
715 va_end(args); | 718 va_end(args); |
716 | 719 |
717 while (--n && (buf[n] == CR || buf[n] == LF)) { /* void */ } | 720 while (--n && (buf[n] == CR || buf[n] == LF)) { /* void */ } |
718 | 721 |
719 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, | 722 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, |
720 "libxml2 error: \"%*s\"", n, buf); | 723 "libxml2 error: \"%*s\"", n + 1, buf); |
721 } | 724 } |
722 | 725 |
723 | 726 |
724 static ngx_buf_t * | 727 static ngx_buf_t * |
725 ngx_http_xslt_apply_stylesheet(ngx_http_request_t *r, | 728 ngx_http_xslt_apply_stylesheet(ngx_http_request_t *r, |