aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2018-06-13 15:28:11 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2018-06-13 15:28:11 +0300
commit9b6bc8a5787d270a54a3465a23eef22cee870e37 (patch)
tree79061eef6e2adfb7726bda59e5bf2c636549dcfb /src/http/ngx_http_upstream.c
parentfb3a9e28b233f3c2823487378622e7cf4284857a (diff)
downloadnginx-9b6bc8a5787d270a54a3465a23eef22cee870e37.tar.gz
nginx-9b6bc8a5787d270a54a3465a23eef22cee870e37.zip
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.)
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 8fc3042e7..47cc6cc55 100644
--- 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_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;