comparison src/http/ngx_http_file_cache.c @ 498:207ae3ff0444 NGINX_0_8_1

nginx 0.8.1 *) Feature: the "updating" parameter in "proxy_cache_use_stale" and "fastcgi_cache_use_stale" directives. *) Bugfix: the "If-Modified-Since", "If-Range", etc. client request header lines were passed to backend while caching if no "proxy_set_header" directive was used with any parameters. *) Bugfix: the "Set-Cookie" and "P3P" response header lines were not hidden while caching if no "proxy_hide_header/fastcgi_hide_header" directives were used with any parameters. *) Bugfix: the ngx_http_image_filter_module did not support GIF87a format. Thanks to Denis Ilyinyh. *) Bugfix: nginx could not be built modules on Solaris 10 and early; the bug had appeared in 0.7.56.
author Igor Sysoev <http://sysoev.ru>
date Mon, 08 Jun 2009 00:00:00 +0400
parents 549994537f15
children 13b908d5338a
comparison
equal deleted inserted replaced
497:77fae36a61b3 498:207ae3ff0444
170 return NGX_ERROR; 170 return NGX_ERROR;
171 } 171 }
172 172
173 rc = ngx_http_file_cache_exists(cache, c); 173 rc = ngx_http_file_cache_exists(cache, c);
174 174
175 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 175 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
176 "http file cache exists: %i u:%ui e:%d", 176 "http file cache exists: %i e:%d", rc, c->exists);
177 rc, c->uses, c->exists);
178 177
179 if (rc == NGX_ERROR) { 178 if (rc == NGX_ERROR) {
180 return rc; 179 return rc;
181 } 180 }
182 181
330 329
331 now = ngx_time(); 330 now = ngx_time();
332 331
333 if (c->valid_sec < now) { 332 if (c->valid_sec < now) {
334 333
335 c->uses = c->min_uses; 334 ngx_shmtx_lock(&cache->shpool->mutex);
336 335
337 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 336 if (c->node->updating) {
338 "http file cache expired: %T %T", c->valid_sec, now); 337 rc = NGX_HTTP_CACHE_UPDATING;
339 338
340 return NGX_HTTP_CACHE_STALE; 339 } else {
341 } 340 c->node->updating = 1;
342 341 rc = NGX_HTTP_CACHE_STALE;
343 /* TODO: NGX_HTTP_CACHE_AGED */ 342 }
343
344 ngx_shmtx_unlock(&cache->shpool->mutex);
345
346 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
347 "http file cache expired: %i %T %T",
348 rc, c->valid_sec, now);
349
350 return rc;
351 }
344 352
345 return NGX_OK; 353 return NGX_OK;
346 } 354 }
347 355
348 356
440 fcn->expire = ngx_time() + cache->inactive; 448 fcn->expire = ngx_time() + cache->inactive;
441 449
442 ngx_queue_insert_head(&cache->sh->queue, &fcn->queue); 450 ngx_queue_insert_head(&cache->sh->queue, &fcn->queue);
443 451
444 c->uniq = fcn->uniq; 452 c->uniq = fcn->uniq;
445 c->uses = fcn->uses;
446 c->error = fcn->error; 453 c->error = fcn->error;
447 c->node = fcn; 454 c->node = fcn;
448 455
449 failed: 456 failed:
450 457
652 659
653 if (rc == NGX_OK) { 660 if (rc == NGX_OK) {
654 c->node->exists = 1; 661 c->node->exists = 1;
655 } 662 }
656 663
664 c->node->updating = 0;
665
657 ngx_shmtx_unlock(&cache->shpool->mutex); 666 ngx_shmtx_unlock(&cache->shpool->mutex);
658 } 667 }
659 668
660 669
661 ngx_int_t 670 ngx_int_t
733 if (c->error) { 742 if (c->error) {
734 c->node->valid_sec = c->valid_sec; 743 c->node->valid_sec = c->valid_sec;
735 c->node->valid_msec = c->valid_msec; 744 c->node->valid_msec = c->valid_msec;
736 c->node->error = c->error; 745 c->node->error = c->error;
737 } 746 }
747
748 c->node->updating = 0;
738 749
739 ngx_shmtx_unlock(&cache->shpool->mutex); 750 ngx_shmtx_unlock(&cache->shpool->mutex);
740 751
741 if (c->temp_file) { 752 if (c->temp_file) {
742 if (tf && tf->file.fd != NGX_INVALID_FILE) { 753 if (tf && tf->file.fd != NGX_INVALID_FILE) {