# HG changeset patch # User Maxim Dounin # Date 1528892891 -10800 # Node ID a10e5fe447625a7340c56a3963a3366633a9c179 # Parent 8e6bb4e6045f7197923717831d2ddf414aa0f443 Upstream: disable body cleanup with preserve_output (ticket #1565). 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.) diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2901,7 +2901,8 @@ ngx_http_upstream_send_response(ngx_http } 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;