aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 210f3bbc1..08c4e5781 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2985,6 +2985,7 @@ ngx_http_upstream_process_request(ngx_http_request_t *r)
tf = p->temp_file;
if (u->headers_in.status_n == NGX_HTTP_OK
+ && (p->upstream_done || p->length == -1)
&& (u->headers_in.content_length_n == -1
|| u->headers_in.content_length_n == tf->offset))
{
@@ -3005,9 +3006,10 @@ ngx_http_upstream_process_request(ngx_http_request_t *r)
tf = p->temp_file;
- if (u->headers_in.content_length_n == -1
- || u->headers_in.content_length_n
- == tf->offset - (off_t) r->cache->body_start)
+ if (p->length == -1
+ && (u->headers_in.content_length_n == -1
+ || u->headers_in.content_length_n
+ == tf->offset - (off_t) r->cache->body_start))
{
ngx_http_file_cache_update(r, tf);