aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-07-18 20:11:40 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2014-07-18 20:11:40 +0400
commit248baf4262c6957b324aad4711dfcb681d4fa23d (patch)
treef3909d2d087382c18b077ced9822e026f5890c31
parent88d9289f82e0992727e81b36667936b7187b214f (diff)
downloadnginx-248baf4262c6957b324aad4711dfcb681d4fa23d.tar.gz
nginx-248baf4262c6957b324aad4711dfcb681d4fa23d.zip
Upstream: ngx_http_upstream_store() error handling fixes.
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.
-rw-r--r--src/http/ngx_http_upstream.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index b8812cf7d..58edc62fd 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3253,7 +3253,6 @@ ngx_http_upstream_process_request(ngx_http_request_t *r)
|| u->headers_in.content_length_n == tf->offset))
{
ngx_http_upstream_store(r, u);
- u->store = 0;
}
}
}
@@ -3375,7 +3374,9 @@ ngx_http_upstream_store(ngx_http_request_t *r, ngx_http_upstream_t *u)
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,
@@ -3393,6 +3394,8 @@ ngx_http_upstream_store(ngx_http_request_t *r, ngx_http_upstream_t *u)
tf->file.name.data, path.data);
(void) ngx_ext_rename_file(&tf->file.name, &path, &ext);
+
+ u->store = 0;
}