comparison src/http/modules/ngx_http_xslt_filter_module.c @ 496:f39b9e29530d NGINX_0_8_0

nginx 0.8.0 *) Feature: the "keepalive_requests" directive. *) Feature: the "limit_rate_after" directive. Thanks to Ivan Debnar. *) Bugfix: XLST filter did not work in subrequests. *) Bugfix: in relative paths handling in nginx/Windows. *) Bugfix: in proxy_store, fastcgi_store, proxy_cache, and fastcgi_cache in nginx/Windows. *) Bugfix: in memory allocation error handling. Thanks to Maxim Dounin and Kirill A. Korinskiy.
author Igor Sysoev <http://sysoev.ru>
date Tue, 02 Jun 2009 00:00:00 +0400
parents 499474178a11
children 4b0d7f0bf22b
comparison
equal deleted inserted replaced
495:6d9fb4461113 496:f39b9e29530d
278 xmlFreeParserCtxt(ctx->ctxt); 278 xmlFreeParserCtxt(ctx->ctxt);
279 279
280 return ngx_http_xslt_send(r, ctx, NULL); 280 return ngx_http_xslt_send(r, ctx, NULL);
281 } 281 }
282 282
283 if (cl->buf->last_buf) { 283 if (cl->buf->last_buf || cl->buf->last_in_chain) {
284 284
285 ctx->doc = ctx->ctxt->myDoc; 285 ctx->doc = ctx->ctxt->myDoc;
286 286
287 #if (NGX_HTTP_XSLT_REUSE_DTD) 287 #if (NGX_HTTP_XSLT_REUSE_DTD)
288 ctx->doc->extSubset = NULL; 288 ctx->doc->extSubset = NULL;
425 425
426 ctx->ctxt = ctxt; 426 ctx->ctxt = ctxt;
427 ctx->request = r; 427 ctx->request = r;
428 } 428 }
429 429
430 err = xmlParseChunk(ctx->ctxt, (char *) b->pos, 430 err = xmlParseChunk(ctx->ctxt, (char *) b->pos, (int) (b->last - b->pos),
431 (int) (b->last - b->pos), b->last_buf); 431 (b->last_buf) || (b->last_in_chain));
432 432
433 if (err == 0) { 433 if (err == 0) {
434 b->pos = b->last; 434 b->pos = b->last;
435 return NGX_OK; 435 return NGX_OK;
436 } 436 }
810 } 810 }
811 811
812 b->pos = buf; 812 b->pos = buf;
813 b->last = buf + len; 813 b->last = buf + len;
814 b->memory = 1; 814 b->memory = 1;
815 b->last_buf = 1;
816 815
817 if (encoding) { 816 if (encoding) {
818 r->headers_out.charset.len = ngx_strlen(encoding); 817 r->headers_out.charset.len = ngx_strlen(encoding);
819 r->headers_out.charset.data = encoding; 818 r->headers_out.charset.data = encoding;
820 } 819 }
821 820
822 if (r != r->main) { 821 if (r != r->main) {
823 return b; 822 return b;
824 } 823 }
824
825 b->last_buf = 1;
825 826
826 if (type) { 827 if (type) {
827 len = ngx_strlen(type); 828 len = ngx_strlen(type);
828 829
829 r->headers_out.content_type_len = len; 830 r->headers_out.content_type_len = len;
1166 { 1167 {
1167 ngx_http_xslt_filter_main_conf_t *conf; 1168 ngx_http_xslt_filter_main_conf_t *conf;
1168 1169
1169 conf = ngx_palloc(cf->pool, sizeof(ngx_http_xslt_filter_main_conf_t)); 1170 conf = ngx_palloc(cf->pool, sizeof(ngx_http_xslt_filter_main_conf_t));
1170 if (conf == NULL) { 1171 if (conf == NULL) {
1171 return NGX_CONF_ERROR; 1172 return NULL;
1172 } 1173 }
1173 1174
1174 if (ngx_array_init(&conf->dtd_files, cf->pool, 1, 1175 if (ngx_array_init(&conf->dtd_files, cf->pool, 1,
1175 sizeof(ngx_http_xslt_file_t)) 1176 sizeof(ngx_http_xslt_file_t))
1176 != NGX_OK) 1177 != NGX_OK)
1194 { 1195 {
1195 ngx_http_xslt_filter_loc_conf_t *conf; 1196 ngx_http_xslt_filter_loc_conf_t *conf;
1196 1197
1197 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_xslt_filter_loc_conf_t)); 1198 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_xslt_filter_loc_conf_t));
1198 if (conf == NULL) { 1199 if (conf == NULL) {
1199 return NGX_CONF_ERROR; 1200 return NULL;
1200 } 1201 }
1201 1202
1202 /* 1203 /*
1203 * set by ngx_pcalloc(): 1204 * set by ngx_pcalloc():
1204 * 1205 *