Previously, ngx_http_map_uri_to_path() errors were not checked in
ngx_http_upstream_store(). Moreover, in case of errors temporary
files were not deleted, as u->store was set to 0, preventing cleanup
code in ngx_http_upstream_finalize_request() from removing them. With
this patch, u->store is set to 0 only if there were no errors.
Reported by Feng Gu.
|| u->headers_in.content_length_n == tf->offset))
{
ngx_http_upstream_store(r, u);
- u->store = 0;
}
}
}
if (u->conf->store_lengths == NULL) {
- ngx_http_map_uri_to_path(r, &path, &root, 0);
+ if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) {
+ return;
+ }
} else {
if (ngx_http_script_run(r, &path, u->conf->store_lengths->elts, 0,
tf->file.name.data, path.data);
(void) ngx_ext_rename_file(&tf->file.name, &path, &ext);
+
+ u->store = 0;
}