diff options
author | Igor Sysoev <igor@sysoev.ru> | 2011-08-30 20:34:58 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2011-08-30 20:34:58 +0000 |
commit | 65b1592d0205c384cc4c0eae92501978dcb18009 (patch) | |
tree | 75daae5b02d8602e078afe7dff6a90f1c77934a7 /src | |
parent | 1f3280bae2b3a3e70471d382bdfa13a06a53eae0 (diff) | |
download | nginx-65b1592d0205c384cc4c0eae92501978dcb18009.tar.gz nginx-65b1592d0205c384cc4c0eae92501978dcb18009.zip |
*) 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.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_range_filter_module.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c index 55a37d416..3e416b302 100644 --- 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 *r, ngx_http_range_filter_ctx_t *ctx) 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 *r, ngx_http_range_filter_ctx_t *ctx) found: - range = ngx_array_push(&ctx->ranges); - if (range == NULL) { - return NGX_ERROR; - } - - range->start = start; - range->end = end; + if (start < end) { + range = ngx_array_push(&ctx->ranges); + if (range == NULL) { + return NGX_ERROR; + } - size += end - start; + range->start = start; + range->end = end; - skip: + size += end - start; + } if (*p++ != ',') { break; |