mirror of
https://github.com/nginx/nginx.git
synced 2025-01-08 07:03:01 -06:00
*) 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.
This commit is contained in:
parent
1f3280bae2
commit
65b1592d02
@ -295,10 +295,6 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx)
|
|||||||
end = content_length - 1;
|
end = content_length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start >= content_length || start > end) {
|
|
||||||
goto skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (end >= content_length) {
|
if (end >= content_length) {
|
||||||
end = content_length;
|
end = content_length;
|
||||||
|
|
||||||
@ -308,6 +304,7 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx)
|
|||||||
|
|
||||||
found:
|
found:
|
||||||
|
|
||||||
|
if (start < end) {
|
||||||
range = ngx_array_push(&ctx->ranges);
|
range = ngx_array_push(&ctx->ranges);
|
||||||
if (range == NULL) {
|
if (range == NULL) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
@ -317,8 +314,7 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx)
|
|||||||
range->end = end;
|
range->end = end;
|
||||||
|
|
||||||
size += end - start;
|
size += end - start;
|
||||||
|
}
|
||||||
skip:
|
|
||||||
|
|
||||||
if (*p++ != ',') {
|
if (*p++ != ',') {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user