diff src/http/ngx_http_upstream.c @ 5874:2aff40b3dea2

Upstream: proxy_force_ranges and friends. The directives enable byte ranges for both cached and uncached responses regardless of backend headers.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 14 Oct 2014 18:32:01 +0400
parents fd283aa92e04
children 60fde1bc7236
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2276,6 +2276,17 @@ ngx_http_upstream_process_headers(ngx_ht
 
     r->disable_not_modified = !u->cacheable;
 
+    if (u->conf->force_ranges) {
+        r->allow_ranges = 1;
+        r->single_range = 1;
+
+#if (NGX_HTTP_CACHE)
+        if (r->cached) {
+            r->single_range = 0;
+        }
+#endif
+    }
+
     u->length = -1;
 
     return NGX_OK;
@@ -4393,6 +4404,10 @@ ngx_http_upstream_copy_allow_ranges(ngx_
 {
     ngx_table_elt_t  *ho;
 
+    if (r->upstream->conf->force_ranges) {
+        return NGX_OK;
+    }
+
 #if (NGX_HTTP_CACHE)
 
     if (r->cached) {