]> git.kaiwu.me - nginx.git/commitdiff
Upstream: disable body cleanup with preserve_output (ticket #1565).
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 13 Jun 2018 12:28:11 +0000 (15:28 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 13 Jun 2018 12:28:11 +0000 (15:28 +0300)
With u->conf->preserve_output set the request body file might be used
after the response header is sent, so avoid cleaning it.  (Normally
this is not a problem as u->conf->preserve_output is only set with
r->request_body_no_buffering, but the request body might be already
written to a file in a different context.)

src/http/ngx_http_upstream.c

index 8fc3042e7eff2b9d18a302e7fd96891f5584b03f..47cc6cc552c6125a15df4d336f512e2aac33dc1b 100644 (file)
@@ -2901,7 +2901,8 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
     }
 
     if (r->request_body && r->request_body->temp_file
-        && r == r->main && !r->preserve_body)
+        && r == r->main && !r->preserve_body
+        && !u->conf->preserve_output)
     {
         ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd);
         r->request_body->temp_file->file.fd = NGX_INVALID_FILE;