comparison src/http/ngx_http_upstream.c @ 3711:ce6ba077c270

several changes in cache cleanup handling: *) now ngx_http_file_cache_cleanup() uses ngx_http_file_cache_free() *) ngx_http_file_cache_free() interface has been changed to accept r->cache ngx_http_file_cache_cleanup() must use r->cache, but not r, because there can be several r->cache's during request processing, r->cache may be NULL at request finalising, etc. *) test if updating request does not complete correctly
author Igor Sysoev <igor@sysoev.ru>
date Wed, 28 Jul 2010 15:49:34 +0000
parents 64777690c697
children f0b62d1ac7af
comparison
equal deleted inserted replaced
3710:5f63b6ab4d4b 3711:ce6ba077c270
1733 if (valid) { 1733 if (valid) {
1734 r->cache->valid_sec = ngx_time() + valid; 1734 r->cache->valid_sec = ngx_time() + valid;
1735 r->cache->error = status; 1735 r->cache->error = status;
1736 } 1736 }
1737 1737
1738 ngx_http_file_cache_free(r, u->pipe->temp_file); 1738 ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
1739 } 1739 }
1740 #endif 1740 #endif
1741 ngx_http_upstream_finalize_request(r, u, status); 1741 ngx_http_upstream_finalize_request(r, u, status);
1742 1742
1743 return NGX_OK; 1743 return NGX_OK;
2187 2187
2188 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 2188 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
2189 "http cacheable: %d", u->cacheable); 2189 "http cacheable: %d", u->cacheable);
2190 2190
2191 if (u->cacheable == 0 && r->cache) { 2191 if (u->cacheable == 0 && r->cache) {
2192 ngx_http_file_cache_free(r, u->pipe->temp_file); 2192 ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
2193 } 2193 }
2194 2194
2195 #endif 2195 #endif
2196 2196
2197 p = u->pipe; 2197 p = u->pipe;
2662 /* TODO: check length & update cache */ 2662 /* TODO: check length & update cache */
2663 2663
2664 ngx_http_file_cache_update(r, u->pipe->temp_file); 2664 ngx_http_file_cache_update(r, u->pipe->temp_file);
2665 2665
2666 } else if (p->upstream_error) { 2666 } else if (p->upstream_error) {
2667 ngx_http_file_cache_free(r, u->pipe->temp_file); 2667 ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
2668 } 2668 }
2669 } 2669 }
2670 2670
2671 #endif 2671 #endif
2672 2672
3003 r->cache->valid_sec = ngx_time() + valid; 3003 r->cache->valid_sec = ngx_time() + valid;
3004 r->cache->error = rc; 3004 r->cache->error = rc;
3005 } 3005 }
3006 } 3006 }
3007 3007
3008 ngx_http_file_cache_free(r, u->pipe->temp_file); 3008 ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
3009 } 3009 }
3010 3010
3011 #endif 3011 #endif
3012 3012
3013 if (u->header_sent 3013 if (u->header_sent