Mercurial > hg > nginx
comparison src/http/modules/ngx_http_image_filter_module.c @ 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 | 31932b5464f0 |
children | 2cfc095a607a |
comparison
equal
deleted
inserted
replaced
5347:011d72dea802 | 5348:317e0893a1e6 |
---|---|
476 | 476 |
477 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 477 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
478 "image buf: %uz", size); | 478 "image buf: %uz", size); |
479 | 479 |
480 rest = ctx->image + ctx->length - p; | 480 rest = ctx->image + ctx->length - p; |
481 size = (rest < size) ? rest : size; | 481 |
482 if (size > rest) { | |
483 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
484 "image filter: too big response"); | |
485 return NGX_ERROR; | |
486 } | |
482 | 487 |
483 p = ngx_cpymem(p, b->pos, size); | 488 p = ngx_cpymem(p, b->pos, size); |
484 b->pos += size; | 489 b->pos += size; |
485 | 490 |
486 if (b->last_buf) { | 491 if (b->last_buf) { |