Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: ngx_http_upstream_store() error handling fixes.

Maxim Dounin
July 18, 2014 12:14PM
details: http://hg.nginx.org/nginx/rev/9de5820bb3e0
branches:
changeset: 5770:9de5820bb3e0
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Jul 18 20:11:40 2014 +0400
description:
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.

diffstat:

src/http/ngx_http_upstream.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diffs (31 lines):

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
@@ -3253,7 +3253,6 @@ ngx_http_upstream_process_request(ngx_ht
|| 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

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
tf->file.name.data, path.data);

(void) ngx_ext_rename_file(&tf->file.name, &path, &ext);
+
+ u->store = 0;
}



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: ngx_http_upstream_store() error handling fixes.

Maxim Dounin 581 July 18, 2014 12:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready