<div dir="ltr"><div># HG changeset patch</div><div># User Lanshun Zhou <<a href="mailto:zls.sogou@gmail.com">zls.sogou@gmail.com</a>></div><div># Date 1377620347 -28800</div><div># Node ID 4fae04f332b489c85cdc116e6138a618372d3691</div>
<div># Parent d1403de4163100ec0c6c015e57f22384456870e3</div><div>Image filter: large image handling.</div><div><br></div><div>If Content-Length header is not set, and the image size is larger than the</div><div>buffer size, client will hang until a timeout occurs.</div>
<div><br></div><div>Now NGX_HTTP_UNSUPPORTED_MEDIA_TYPE is returned immediately.</div><div><br></div><div>diff -r d1403de41631 -r 4fae04f332b4 src/http/modules/ngx_http_image_filter_module.c</div><div>--- a/src/http/modules/ngx_http_image_filter_module.c Tue Aug 27 17:37:15 2013 +0400</div>
<div>+++ b/src/http/modules/ngx_http_image_filter_module.c Wed Aug 28 00:19:07 2013 +0800</div><div>@@ -478,7 +478,14 @@</div><div> "image buf: %uz", size);</div><div> </div><div> rest = ctx->image + ctx->length - p;</div>
<div>- size = (rest < size) ? rest : size;</div><div>+ if (rest < size) {</div><div>+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,</div><div>+ "image filter: too big response: >%z, "</div>
<div>+ "try to increase image_filter_buffer",</div><div>+ ctx->length);</div><div>+</div><div>+ return NGX_ERROR;</div><div>+ }</div><div> </div>
<div> p = ngx_cpymem(p, b->pos, size);</div><div> b->pos += size;</div></div>