Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 2643:002f6fd88177 stable-0.6
r2446 merge:
proxy/fastcgi_store did not delete incomplete files
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 01 Apr 2009 16:15:54 +0000 |
parents | 8deee4408c94 |
children | 2baa184412b8 |
comparison
equal
deleted
inserted
replaced
2642:976e000dbb9f | 2643:002f6fd88177 |
---|---|
1957 | 1957 |
1958 | 1958 |
1959 static void | 1959 static void |
1960 ngx_http_upstream_process_body(ngx_event_t *ev) | 1960 ngx_http_upstream_process_body(ngx_event_t *ev) |
1961 { | 1961 { |
1962 ngx_uint_t del; | |
1962 ngx_temp_file_t *tf; | 1963 ngx_temp_file_t *tf; |
1963 ngx_event_pipe_t *p; | 1964 ngx_event_pipe_t *p; |
1964 ngx_connection_t *c, *downstream; | 1965 ngx_connection_t *c, *downstream; |
1965 ngx_http_log_ctx_t *ctx; | 1966 ngx_http_log_ctx_t *ctx; |
1966 ngx_http_request_t *r; | 1967 ngx_http_request_t *r; |
2052 | 2053 |
2053 if (u->peer.connection) { | 2054 if (u->peer.connection) { |
2054 | 2055 |
2055 if (u->store) { | 2056 if (u->store) { |
2056 | 2057 |
2058 del = p->upstream_error; | |
2059 | |
2057 tf = u->pipe->temp_file; | 2060 tf = u->pipe->temp_file; |
2058 | 2061 |
2059 if (p->upstream_eof | 2062 if (p->upstream_eof) { |
2060 && u->headers_in.status_n == NGX_HTTP_OK | 2063 |
2061 && (u->headers_in.content_length_n == -1 | 2064 if (u->headers_in.status_n == NGX_HTTP_OK |
2062 || (u->headers_in.content_length_n == tf->offset))) | 2065 && (u->headers_in.content_length_n == -1 |
2063 { | 2066 || (u->headers_in.content_length_n == tf->offset))) |
2064 ngx_http_upstream_store(r, u); | 2067 { |
2065 | 2068 ngx_http_upstream_store(r, u); |
2066 } else if ((p->upstream_error | 2069 |
2067 || (p->upstream_eof | 2070 } else { |
2068 && u->headers_in.status_n != NGX_HTTP_OK)) | 2071 del = 1; |
2069 && tf->file.fd != NGX_INVALID_FILE) | 2072 } |
2070 { | 2073 } |
2074 | |
2075 if (del && tf->file.fd != NGX_INVALID_FILE) { | |
2076 | |
2071 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { | 2077 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { |
2072 | 2078 |
2073 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 2079 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
2074 ngx_delete_file_n " \"%s\" failed", | 2080 ngx_delete_file_n " \"%s\" failed", |
2075 u->pipe->temp_file->file.name.data); | 2081 u->pipe->temp_file->file.name.data); |