# HG changeset patch # User Igor Sysoev # Date 1314709315 0 # Node ID e9213133993a50dbd0ec79848e7d77d7d56ffe47 # Parent 9cce506be97d3936a309eaa68ba16521c73726f7 Now unsatisfiable ranges are processed according to RFC 2616. 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 @@ -264,7 +264,7 @@ ngx_http_range_parse(ngx_http_request_t } if (start >= r->headers_out.content_length_n) { - return NGX_HTTP_RANGE_NOT_SATISFIABLE; + goto skip; } while (*p == ' ') { p++; } @@ -299,14 +299,10 @@ ngx_http_range_parse(ngx_http_request_t } if (start > end) { - return NGX_HTTP_RANGE_NOT_SATISFIABLE; + goto skip; } if (end >= r->headers_out.content_length_n) { - /* - * Download Accelerator sends the last byte position - * that equals to the file length - */ end = r->headers_out.content_length_n; } else { @@ -325,11 +321,17 @@ ngx_http_range_parse(ngx_http_request_t size += end - start; + skip: + if (*p++ != ',') { break; } } + if (ctx->ranges.nelts == 0) { + return NGX_HTTP_RANGE_NOT_SATISFIABLE; + } + if (size > r->headers_out.content_length_n) { return NGX_DECLINED; }