Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.c @ 2445:3c6af1fb7586
proxy/fastcgi_store did not delete incomplete files
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 16 Jan 2009 13:57:00 +0000 |
parents | 0c117a89f399 |
children | 4bc8ea10d62b |
comparison
equal
deleted
inserted
replaced
2444:aee735f41627 | 2445:3c6af1fb7586 |
---|---|
2199 | 2199 |
2200 | 2200 |
2201 static void | 2201 static void |
2202 ngx_http_upstream_process_request(ngx_http_request_t *r) | 2202 ngx_http_upstream_process_request(ngx_http_request_t *r) |
2203 { | 2203 { |
2204 ngx_uint_t del; | |
2204 ngx_temp_file_t *tf; | 2205 ngx_temp_file_t *tf; |
2205 ngx_event_pipe_t *p; | 2206 ngx_event_pipe_t *p; |
2206 ngx_http_upstream_t *u; | 2207 ngx_http_upstream_t *u; |
2207 | 2208 |
2208 u = r->upstream; | 2209 u = r->upstream; |
2210 | 2211 |
2211 if (u->peer.connection) { | 2212 if (u->peer.connection) { |
2212 | 2213 |
2213 if (u->store) { | 2214 if (u->store) { |
2214 | 2215 |
2216 del = p->upstream_error; | |
2217 | |
2215 tf = u->pipe->temp_file; | 2218 tf = u->pipe->temp_file; |
2216 | 2219 |
2217 if (p->upstream_eof | 2220 if (p->upstream_eof) { |
2218 && u->headers_in.status_n == NGX_HTTP_OK | 2221 |
2219 && (u->headers_in.content_length_n == -1 | 2222 if (u->headers_in.status_n == NGX_HTTP_OK |
2220 || (u->headers_in.content_length_n == tf->offset))) | 2223 && (u->headers_in.content_length_n == -1 |
2221 { | 2224 || (u->headers_in.content_length_n == tf->offset))) |
2222 ngx_http_upstream_store(r, u); | 2225 { |
2223 | 2226 ngx_http_upstream_store(r, u); |
2224 } else if ((p->upstream_error | 2227 |
2225 || (p->upstream_eof | 2228 } else { |
2226 && u->headers_in.status_n != NGX_HTTP_OK)) | 2229 del = 1; |
2227 && tf->file.fd != NGX_INVALID_FILE) | 2230 } |
2228 { | 2231 } |
2232 | |
2233 if (del && tf->file.fd != NGX_INVALID_FILE) { | |
2234 | |
2229 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { | 2235 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { |
2230 | 2236 |
2231 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 2237 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
2232 ngx_delete_file_n " \"%s\" failed", | 2238 ngx_delete_file_n " \"%s\" failed", |
2233 u->pipe->temp_file->file.name.data); | 2239 u->pipe->temp_file->file.name.data); |