Client disconnect in ngx_http_image_filter_module

Dan Podeanu pdan at esync.org
Wed Apr 29 13:03:46 UTC 2015


Ok fair enough- I am new to the nginx source code.

What would be a better fix ?

> On Apr 29, 2015, at 7:30 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 
> 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/
> 
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel



More information about the nginx-devel mailing list