Client disconnect in ngx_http_image_filter_module

Maxim Dounin mdounin at mdounin.ru
Wed Apr 29 12:30:02 UTC 2015


Hello!

On Wed, Apr 29, 2015 at 12:30:35PM +0700, Dan Podeanu wrote:

> Thank you for the feedback- 
> http://trac.nginx.org/nginx/ticket/756 
> <http://trac.nginx.org/nginx/ticket/756>

Thanks.

> Regarding the fix, I do not believe bytes are silently skipped- 
> if you look further below in 
> src/http/modules/ngx_http_image_filter_module.c:
> 
> switch (ctx->phase) {
> 	case NGX_HTTP_IMAGE_START:
> 		ctx->type = ngx_http_image_test(r, in);
> 		….
> 		if (ctx->type == NGX_HTTP_IMAGE_NONE) {
> 			….
> 			/* wait to consume more data, do not give 
> 			up on the request right away */
> 			return NGX_OK; /* as in the patch */
> 		}
> 		….
> 		/* fall-through */
> 	case NGX_HTTP_IMAGE_READ:
>> 		/* fall-through */
> 	case NGX_HTTP_IMAGE_PROCESS:
>> }
> 
> i.e. that section of code is, correctly, designed to maintain 
> state and be called repeatedly for the same image. In any case, 
> we are no longer able to replicate the bug once we have applied 
> the patch.

The problem is that you return NGX_OK, and all the code designed to 
store the response bits from the "in" chain will be skipped.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list