Mercurial > hg > nginx
changeset 5348:317e0893a1e6
Image filter: large image handling.
If Content-Length header is not set, and the image size is larger than the
buffer size, client will hang until a timeout occurs.
Now NGX_HTTP_UNSUPPORTED_MEDIA_TYPE is returned immediately.
diff -r d1403de41631 -r 4fae04f332b4
src/http/modules/ngx_http_image_filter_module.c
author | Lanshun Zhou <zls.sogou@gmail.com> |
---|---|
date | Wed, 28 Aug 2013 00:19:07 +0800 |
parents | 011d72dea802 |
children | 9b8a634e348a |
files | src/http/modules/ngx_http_image_filter_module.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_image_filter_module.c Wed Aug 28 02:34:30 2013 +0400 +++ b/src/http/modules/ngx_http_image_filter_module.c Wed Aug 28 00:19:07 2013 +0800 @@ -478,7 +478,12 @@ "image buf: %uz", size); rest = ctx->image + ctx->length - p; - size = (rest < size) ? rest : size; + + if (size > rest) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "image filter: too big response"); + return NGX_ERROR; + } p = ngx_cpymem(p, b->pos, size); b->pos += size;