aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2014-10-14 18:32:01 +0400
committerRoman Arutyunyan <arut@nginx.com>2014-10-14 18:32:01 +0400
commit2244a5e9cf40d271ddf31f083acd694b5d9f13b4 (patch)
tree970d41c3114c3d10ebccaa30dbbdd687752b5c36 /src/http/ngx_http_upstream.c
parent8ae7751878b60f2822e530cd8b5d26b59ea9236a (diff)
downloadnginx-2244a5e9cf40d271ddf31f083acd694b5d9f13b4.tar.gz
nginx-2244a5e9cf40d271ddf31f083acd694b5d9f13b4.zip
Upstream: proxy_force_ranges and friends.
The directives enable byte ranges for both cached and uncached responses regardless of backend headers.
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index d574a6a31..ca6db5cf1 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2276,6 +2276,17 @@ ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u)
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_http_request_t *r,
{
ngx_table_elt_t *ho;
+ if (r->upstream->conf->force_ranges) {
+ return NGX_OK;
+ }
+
#if (NGX_HTTP_CACHE)
if (r->cached) {