Mercurial > hg > nginx
changeset 4060:45de8d258085
*) fix of r4060: start value should be tested after the "found" label;
*) optimization: start value may be tested against end value only,
since end value here may not be greater than content_length.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 30 Aug 2011 20:34:58 +0000 |
parents | cc72e6229416 |
children | bd2ec6ce5d58 |
files | src/http/modules/ngx_http_range_filter_module.c |
diffstat | 1 files changed, 9 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_range_filter_module.c Tue Aug 30 14:25:35 2011 +0000 +++ b/src/http/modules/ngx_http_range_filter_module.c Tue Aug 30 20:34:58 2011 +0000 @@ -295,10 +295,6 @@ end = content_length - 1; } - if (start >= content_length || start > end) { - goto skip; - } - if (end >= content_length) { end = content_length; @@ -308,17 +304,17 @@ found: - range = ngx_array_push(&ctx->ranges); - if (range == NULL) { - return NGX_ERROR; - } + if (start < end) { + range = ngx_array_push(&ctx->ranges); + if (range == NULL) { + return NGX_ERROR; + } - range->start = start; - range->end = end; + range->start = start; + range->end = end; - size += end - start; - - skip: + size += end - start; + } if (*p++ != ',') { break;