Mercurial > hg > nginx-quic
comparison 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 |
comparison
equal
deleted
inserted
replaced
2820:5eb4e2d2e9fa | 2821:26e06e009ced |
---|---|
179 "image filter: multipart/x-mixed-replace response"); | 179 "image filter: multipart/x-mixed-replace response"); |
180 | 180 |
181 return NGX_ERROR; | 181 return NGX_ERROR; |
182 } | 182 } |
183 | 183 |
184 ctx = ngx_http_get_module_ctx(r, ngx_http_image_filter_module); | |
185 | |
186 if (ctx) { | |
187 ngx_http_set_ctx(r, NULL, ngx_http_image_filter_module); | |
188 return ngx_http_next_header_filter(r); | |
189 } | |
190 | |
184 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_image_filter_ctx_t)); | 191 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_image_filter_ctx_t)); |
185 if (ctx == NULL) { | 192 if (ctx == NULL) { |
186 return NGX_ERROR; | 193 return NGX_ERROR; |
187 } | 194 } |
188 | 195 |
256 return ngx_http_image_send(r, ctx, &out); | 263 return ngx_http_image_send(r, ctx, &out); |
257 } | 264 } |
258 } | 265 } |
259 | 266 |
260 return ngx_http_filter_finalize_request(r, | 267 return ngx_http_filter_finalize_request(r, |
268 &ngx_http_image_filter_module, | |
261 NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); | 269 NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); |
262 } | 270 } |
263 | 271 |
264 /* override content type */ | 272 /* override content type */ |
265 | 273 |
285 return NGX_OK; | 293 return NGX_OK; |
286 } | 294 } |
287 | 295 |
288 if (rc == NGX_ERROR) { | 296 if (rc == NGX_ERROR) { |
289 return ngx_http_filter_finalize_request(r, | 297 return ngx_http_filter_finalize_request(r, |
298 &ngx_http_image_filter_module, | |
290 NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); | 299 NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); |
291 } | 300 } |
292 | 301 |
293 /* fall through */ | 302 /* fall through */ |
294 | 303 |
296 | 305 |
297 out.buf = ngx_http_image_process(r); | 306 out.buf = ngx_http_image_process(r); |
298 | 307 |
299 if (out.buf == NULL) { | 308 if (out.buf == NULL) { |
300 return ngx_http_filter_finalize_request(r, | 309 return ngx_http_filter_finalize_request(r, |
310 &ngx_http_image_filter_module, | |
301 NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); | 311 NGX_HTTP_UNSUPPORTED_MEDIA_TYPE); |
302 } | 312 } |
303 | 313 |
304 out.next = NULL; | 314 out.next = NULL; |
305 ctx->phase = NGX_HTTP_IMAGE_PASS; | 315 ctx->phase = NGX_HTTP_IMAGE_PASS; |