From 451df22b3f07d4e11ea8b32cc932630ae383d280 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 30 Aug 2011 13:01:55 +0000 Subject: [PATCH] Now unsatisfiable ranges are processed according to RFC 2616. --- src/http/modules/ngx_http_range_filter_module.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c index c0a835c3e..6b45e2bea 100644 --- 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 *r, ngx_http_range_filter_ctx_t *ctx) } 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 *r, ngx_http_range_filter_ctx_t *ctx) } 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 *r, ngx_http_range_filter_ctx_t *ctx) 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; }