# HG changeset patch # User Igor Sysoev # Date 1214228134 0 # Node ID 67a29af877edb3bcc327eed12be19221a0f026b6 # Parent 90312b61616249d816444b6a7d7000d992c7b342 initialize of.uniq in ngx_open_cached_file() diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c --- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -189,7 +189,9 @@ ngx_open_cached_file(ngx_open_file_cache } if ((file->event && file->use_event) - || (file->event == NULL && now - file->created < of->valid)) + || (file->event == NULL + && (of->uniq == 0 || of->uniq == file->uniq) + && now - file->created < of->valid)) { if (file->err == 0) { diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c --- a/src/http/modules/ngx_http_flv_module.c +++ b/src/http/modules/ngx_http_flv_module.c @@ -105,6 +105,7 @@ ngx_http_flv_handler(ngx_http_request_t clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + of.uniq = 0; of.test_dir = 0; of.valid = clcf->open_file_cache_valid; of.min_uses = clcf->open_file_cache_min_uses; diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c --- a/src/http/modules/ngx_http_gzip_static_module.c +++ b/src/http/modules/ngx_http_gzip_static_module.c @@ -119,6 +119,7 @@ ngx_http_gzip_static_handler(ngx_http_re clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + of.uniq = 0; of.test_dir = 0; of.valid = clcf->open_file_cache_valid; of.min_uses = clcf->open_file_cache_min_uses; diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c --- a/src/http/modules/ngx_http_index_module.c +++ b/src/http/modules/ngx_http_index_module.c @@ -208,6 +208,7 @@ ngx_http_index_handler(ngx_http_request_ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "open index \"%V\"", &path); + of.uniq = 0; of.test_dir = 0; of.valid = clcf->open_file_cache_valid; of.min_uses = clcf->open_file_cache_min_uses; @@ -291,6 +292,7 @@ ngx_http_index_test_dir(ngx_http_request ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http index check dir: \"%V\"", &dir); + of.uniq = 0; of.test_dir = 1; of.valid = clcf->open_file_cache_valid; of.min_uses = 0; diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c --- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c @@ -96,6 +96,7 @@ ngx_http_static_handler(ngx_http_request clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + of.uniq = 0; of.test_dir = 0; of.valid = clcf->open_file_cache_valid; of.min_uses = clcf->open_file_cache_min_uses; diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs --- a/src/http/modules/perl/nginx.xs +++ b/src/http/modules/perl/nginx.xs @@ -639,14 +639,6 @@ sendfile(r, filename, offset = -1, bytes XSRETURN_EMPTY; } - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - - of.test_dir = 0; - of.valid = clcf->open_file_cache_valid; - of.min_uses = clcf->open_file_cache_min_uses; - of.errors = clcf->open_file_cache_errors; - of.events = clcf->open_file_cache_events; - path.len = ngx_strlen(filename); path.data = ngx_pnalloc(r->pool, path.len + 1); @@ -656,6 +648,15 @@ sendfile(r, filename, offset = -1, bytes (void) ngx_cpystrn(path.data, filename, path.len + 1); + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + + of.uniq = 0; + of.test_dir = 0; + of.valid = clcf->open_file_cache_valid; + of.min_uses = clcf->open_file_cache_min_uses; + of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; + if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) != NGX_OK) { diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c --- a/src/http/ngx_http_script.c +++ b/src/http/ngx_http_script.c @@ -994,6 +994,7 @@ ngx_http_script_file_code(ngx_http_scrip clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + of.uniq = 0; of.test_dir = 0; of.valid = clcf->open_file_cache_valid; of.min_uses = clcf->open_file_cache_min_uses;