Mercurial > hg > nginx
diff src/http/modules/ngx_http_image_filter_module.c @ 2821:26e06e009ced
allow to pass image filter errors via the same location where the filter is set
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 08 May 2009 14:52:50 +0000 |
parents | 43fe53832da7 |
children | 0449d289256c |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_image_filter_module.c +++ b/src/http/modules/ngx_http_image_filter_module.c @@ -181,6 +181,13 @@ ngx_http_image_header_filter(ngx_http_re return NGX_ERROR; } + ctx = ngx_http_get_module_ctx(r, ngx_http_image_filter_module); + + if (ctx) { + ngx_http_set_ctx(r, NULL, ngx_http_image_filter_module); + return ngx_http_next_header_filter(r); + } + ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_image_filter_ctx_t)); if (ctx == NULL) { return NGX_ERROR; @@ -258,6 +265,7 @@ ngx_http_image_body_filter(ngx_http_requ } return ngx_http_filter_finalize_request(r, + &ngx_http_image_filter_module, NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); } @@ -287,6 +295,7 @@ ngx_http_image_body_filter(ngx_http_requ if (rc == NGX_ERROR) { return ngx_http_filter_finalize_request(r, + &ngx_http_image_filter_module, NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); } @@ -298,6 +307,7 @@ ngx_http_image_body_filter(ngx_http_requ if (out.buf == NULL) { return ngx_http_filter_finalize_request(r, + &ngx_http_image_filter_module, NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); }