# HG changeset patch # User Igor Sysoev # Date 1245056529 0 # Node ID 9ef3719c4d8ad6e38bbe2b73e6a460260f8d5471 # Parent 2f731201b00ebc6d8743646e313ed4f4be4b35ef merge r2900: fix XSLT filter in SSI subrequests diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -503,6 +503,7 @@ ngx_output_chain_copy_buf(ngx_output_cha if (src->pos == src->last) { dst->flush = src->flush; dst->last_buf = src->last_buf; + dst->last_in_chain = src->last_in_chain; } } else { @@ -577,6 +578,7 @@ ngx_output_chain_copy_buf(ngx_output_cha if (src->file_pos == src->file_last) { dst->flush = src->flush; dst->last_buf = src->last_buf; + dst->last_in_chain = src->last_in_chain; } } 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 @@ -280,7 +280,7 @@ ngx_http_xslt_body_filter(ngx_http_reque return ngx_http_xslt_send(r, ctx, NULL); } - if (cl->buf->last_buf) { + if (cl->buf->last_buf || cl->buf->last_in_chain) { ctx->doc = ctx->ctxt->myDoc; @@ -427,8 +427,8 @@ ngx_http_xslt_add_chunk(ngx_http_request ctx->request = r; } - err = xmlParseChunk(ctx->ctxt, (char *) b->pos, - (int) (b->last - b->pos), b->last_buf); + err = xmlParseChunk(ctx->ctxt, (char *) b->pos, (int) (b->last - b->pos), + (b->last_buf) || (b->last_in_chain)); if (err == 0) { b->pos = b->last; @@ -812,7 +812,6 @@ ngx_http_xslt_apply_stylesheet(ngx_http_ b->pos = buf; b->last = buf + len; b->memory = 1; - b->last_buf = 1; if (encoding) { r->headers_out.charset.len = ngx_strlen(encoding); @@ -823,6 +822,8 @@ ngx_http_xslt_apply_stylesheet(ngx_http_ return b; } + b->last_buf = 1; + if (type) { len = ngx_strlen(type);