comparison src/http/modules/ngx_http_xslt_filter_module.c @ 484:ed5e10fb40fc NGINX_0_7_54

nginx 0.7.54 *) Feature: the ngx_http_image_filter_module. *) Feature: the "proxy_ignore_headers" and "fastcgi_ignore_headers" directives. *) Bugfix: a segmentation fault might occur in worker process, if an "open_file_cache_errors off" directive was used; the bug had appeared in 0.7.53. *) Bugfix: the "port_in_redirect off" directive did not work; the bug had appeared in 0.7.39. *) Bugfix: improve handling of "select" method errors. *) Bugfix: of "select() failed (10022: ...)" error in nginx/Windows. *) Bugfix: in error text descriptions in nginx/Windows; the bug had appeared in 0.7.53.
author Igor Sysoev <http://sysoev.ru>
date Fri, 01 May 2009 00:00:00 +0400
parents c8cfb6c462ef
children 829f9a66a659
comparison
equal deleted inserted replaced
483:0a2f4b42ddad 484:ed5e10fb40fc
62 } ngx_http_xslt_filter_ctx_t; 62 } ngx_http_xslt_filter_ctx_t;
63 63
64 64
65 static ngx_int_t ngx_http_xslt_send(ngx_http_request_t *r, 65 static ngx_int_t ngx_http_xslt_send(ngx_http_request_t *r,
66 ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b); 66 ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b);
67 static ngx_int_t ngx_http_xslt_filter_internal_error(ngx_http_request_t *r);
68 static ngx_int_t ngx_http_xslt_add_chunk(ngx_http_request_t *r, 67 static ngx_int_t ngx_http_xslt_add_chunk(ngx_http_request_t *r,
69 ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b); 68 ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b);
70 69
71 70
72 static void ngx_http_xslt_sax_start_document(void *data); 71 static void ngx_http_xslt_sax_start_document(void *data);
318 ngx_pool_cleanup_t *cln; 317 ngx_pool_cleanup_t *cln;
319 318
320 ctx->done = 1; 319 ctx->done = 1;
321 320
322 if (b == NULL) { 321 if (b == NULL) {
323 return ngx_http_xslt_filter_internal_error(r); 322 return ngx_http_filter_finalize_request(r,
323 NGX_HTTP_INTERNAL_SERVER_ERROR);
324 } 324 }
325 325
326 cln = ngx_pool_cleanup_add(r->pool, 0); 326 cln = ngx_pool_cleanup_add(r->pool, 0);
327 327
328 if (cln == NULL) { 328 if (cln == NULL) {
329 ngx_free(b->pos); 329 ngx_free(b->pos);
330 return ngx_http_special_response_handler(r, 330 return ngx_http_filter_finalize_request(r,
331 NGX_HTTP_INTERNAL_SERVER_ERROR); 331 NGX_HTTP_INTERNAL_SERVER_ERROR);
332 } 332 }
333 333
334 if (r == r->main) { 334 if (r == r->main) {
335 r->headers_out.content_length_n = b->last - b->pos; 335 r->headers_out.content_length_n = b->last - b->pos;
354 354
355 out.buf = b; 355 out.buf = b;
356 out.next = NULL; 356 out.next = NULL;
357 357
358 return ngx_http_next_body_filter(r, &out); 358 return ngx_http_next_body_filter(r, &out);
359 }
360
361
362 static ngx_int_t
363 ngx_http_xslt_filter_internal_error(ngx_http_request_t *r)
364 {
365 ngx_int_t rc;
366
367 /* clear the modules contexts */
368 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
369
370 rc = ngx_http_special_response_handler(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
371
372 /* NGX_ERROR resets any pending data */
373
374 return (rc == NGX_OK) ? NGX_ERROR : rc;
375 } 359 }
376 360
377 361
378 static ngx_int_t 362 static ngx_int_t
379 ngx_http_xslt_add_chunk(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx, 363 ngx_http_xslt_add_chunk(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,