comparison 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
comparison
equal deleted inserted replaced
5873:35b8e5e98508 5874:2aff40b3dea2
2274 2274
2275 r->headers_out.content_length_n = u->headers_in.content_length_n; 2275 r->headers_out.content_length_n = u->headers_in.content_length_n;
2276 2276
2277 r->disable_not_modified = !u->cacheable; 2277 r->disable_not_modified = !u->cacheable;
2278 2278
2279 if (u->conf->force_ranges) {
2280 r->allow_ranges = 1;
2281 r->single_range = 1;
2282
2283 #if (NGX_HTTP_CACHE)
2284 if (r->cached) {
2285 r->single_range = 0;
2286 }
2287 #endif
2288 }
2289
2279 u->length = -1; 2290 u->length = -1;
2280 2291
2281 return NGX_OK; 2292 return NGX_OK;
2282 } 2293 }
2283 2294
4391 ngx_http_upstream_copy_allow_ranges(ngx_http_request_t *r, 4402 ngx_http_upstream_copy_allow_ranges(ngx_http_request_t *r,
4392 ngx_table_elt_t *h, ngx_uint_t offset) 4403 ngx_table_elt_t *h, ngx_uint_t offset)
4393 { 4404 {
4394 ngx_table_elt_t *ho; 4405 ngx_table_elt_t *ho;
4395 4406
4407 if (r->upstream->conf->force_ranges) {
4408 return NGX_OK;
4409 }
4410
4396 #if (NGX_HTTP_CACHE) 4411 #if (NGX_HTTP_CACHE)
4397 4412
4398 if (r->cached) { 4413 if (r->cached) {
4399 r->allow_ranges = 1; 4414 r->allow_ranges = 1;
4400 return NGX_OK; 4415 return NGX_OK;