diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-04-01 16:15:54 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-04-01 16:15:54 +0000 |
commit | 7f18a54c39cd04a1b27a895fbe2e671c6a36832e (patch) | |
tree | b9a1468fbbadfb7b9e5205386ba5f7d3af02588d | |
parent | 9e534e07747a73b22fd55fe89fcb5f087cc156a5 (diff) | |
download | nginx-7f18a54c39cd04a1b27a895fbe2e671c6a36832e.tar.gz |
r2446 merge:
proxy/fastcgi_store did not delete incomplete files
-rw-r--r-- | src/http/ngx_http_upstream.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 83b60f7f5..6eee8832e 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1959,6 +1959,7 @@ ngx_http_upstream_process_downstream(ngx_http_request_t *r) static void ngx_http_upstream_process_body(ngx_event_t *ev) { + ngx_uint_t del; ngx_temp_file_t *tf; ngx_event_pipe_t *p; ngx_connection_t *c, *downstream; @@ -2054,20 +2055,25 @@ ngx_http_upstream_process_body(ngx_event_t *ev) if (u->store) { + del = p->upstream_error; + tf = u->pipe->temp_file; - if (p->upstream_eof - && u->headers_in.status_n == NGX_HTTP_OK - && (u->headers_in.content_length_n == -1 - || (u->headers_in.content_length_n == tf->offset))) - { - ngx_http_upstream_store(r, u); + if (p->upstream_eof) { + + if (u->headers_in.status_n == NGX_HTTP_OK + && (u->headers_in.content_length_n == -1 + || (u->headers_in.content_length_n == tf->offset))) + { + ngx_http_upstream_store(r, u); + + } else { + del = 1; + } + } + + if (del && tf->file.fd != NGX_INVALID_FILE) { - } else if ((p->upstream_error - || (p->upstream_eof - && u->headers_in.status_n != NGX_HTTP_OK)) - && tf->file.fd != NGX_INVALID_FILE) - { if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |