Klaus Demo nginx / 6019a76
proxy/fastcgi_store did not delete incomplete files Igor Sysoev 13 years ago
1 changed file(s) with 18 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
22002200 static void
22012201 ngx_http_upstream_process_request(ngx_http_request_t *r)
22022202 {
2203 ngx_uint_t del;
22032204 ngx_temp_file_t *tf;
22042205 ngx_event_pipe_t *p;
22052206 ngx_http_upstream_t *u;
22112212
22122213 if (u->store) {
22132214
2215 del = p->upstream_error;
2216
22142217 tf = u->pipe->temp_file;
22152218
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
22282234 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) {
22292235
22302236 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,