# HG changeset patch # User Igor Sysoev # Date 1314736498 0 # Node ID 45de8d25808560b0ae13e9131ffb2d7a04710fee # Parent cc72e622941639b68428cc300770350608292fa9 *) 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. diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c --- a/src/http/modules/ngx_http_range_filter_module.c +++ b/src/http/modules/ngx_http_range_filter_module.c @@ -295,10 +295,6 @@ ngx_http_range_parse(ngx_http_request_t end = content_length - 1; } - if (start >= content_length || start > end) { - goto skip; - } - if (end >= content_length) { end = content_length; @@ -308,17 +304,17 @@ ngx_http_range_parse(ngx_http_request_t 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;