changeset 4056:e9213133993a

Now unsatisfiable ranges are processed according to RFC 2616.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 30 Aug 2011 13:01:55 +0000
parents 9cce506be97d
children 3205a6d6c6ec
files src/http/modules/ngx_http_range_filter_module.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_range_filter_module.c	Tue Aug 30 12:45:24 2011 +0000
+++ b/src/http/modules/ngx_http_range_filter_module.c	Tue Aug 30 13:01:55 2011 +0000
@@ -264,7 +264,7 @@
             }
 
             if (start >= r->headers_out.content_length_n) {
-                return NGX_HTTP_RANGE_NOT_SATISFIABLE;
+                goto skip;
             }
 
             while (*p == ' ') { p++; }
@@ -299,14 +299,10 @@
         }
 
         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 @@
 
         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;
     }