unsigned main_filter_need_in_memory:1;
unsigned filter_need_in_memory:1;
unsigned filter_need_temporary:1;
+ unsigned preserve_body:1;
unsigned allow_ranges:1;
unsigned subrequest_ranges:1;
unsigned single_range:1;
return NGX_OK;
}
+ if (r == r->main) {
+ r->preserve_body = 1;
+ }
+
if (ngx_http_subrequest(r, &r->uri, &r->args, &sr, NULL,
NGX_HTTP_SUBREQUEST_CLONE
|NGX_HTTP_SUBREQUEST_BACKGROUND)
u->pipe->downstream_error = 1;
}
- if (r->request_body && r->request_body->temp_file) {
+ if (r->request_body && r->request_body->temp_file
+ && r == r->main && !r->preserve_body)
+ {
ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd);
r->request_body->temp_file->file.fd = NGX_INVALID_FILE;
}