proxy/fastcgi_store did not delete incomplete files
Igor Sysoev
13 years ago
2200 | 2200 | static void |
2201 | 2201 | ngx_http_upstream_process_request(ngx_http_request_t *r) |
2202 | 2202 | { |
2203 | ngx_uint_t del; | |
2203 | 2204 | ngx_temp_file_t *tf; |
2204 | 2205 | ngx_event_pipe_t *p; |
2205 | 2206 | ngx_http_upstream_t *u; |
2211 | 2212 | |
2212 | 2213 | if (u->store) { |
2213 | 2214 | |
2215 | del = p->upstream_error; | |
2216 | ||
2214 | 2217 | tf = u->pipe->temp_file; |
2215 | 2218 | |
2216 | if (p->upstream_eof | |
2217 | && u->headers_in.status_n == NGX_HTTP_OK | |
2218 | && (u->headers_in.content_length_n == -1 | |
2219 | || (u->headers_in.content_length_n == tf->offset))) | |
2220 | { | |
2221 | ngx_http_upstream_store(r, u); | |
2222 | ||
2223 | } else if ((p->upstream_error | |
2224 | || (p->upstream_eof | |
2225 | && u->headers_in.status_n != NGX_HTTP_OK)) | |
2226 | && tf->file.fd != NGX_INVALID_FILE) | |
2227 | { | |
2219 | if (p->upstream_eof) { | |
2220 | ||
2221 | if (u->headers_in.status_n == NGX_HTTP_OK | |
2222 | && (u->headers_in.content_length_n == -1 | |
2223 | || (u->headers_in.content_length_n == tf->offset))) | |
2224 | { | |
2225 | ngx_http_upstream_store(r, u); | |
2226 | ||
2227 | } else { | |
2228 | del = 1; | |
2229 | } | |
2230 | } | |
2231 | ||
2232 | if (del && tf->file.fd != NGX_INVALID_FILE) { | |
2233 | ||
2228 | 2234 | if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { |
2229 | 2235 | |
2230 | 2236 | ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |