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
index d9ec188..4e4c1c5 100644
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -189,7 +189,9 @@
}
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
index 0e19091..5dedb9e 100644
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -105,6 +105,7 @@
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
index e6d44ec..a63281a 100644
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -119,6 +119,7 @@
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
index bd9c18c..0968444 100644
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -208,6 +208,7 @@
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_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
index fc84268..9d48fb9 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -96,6 +96,7 @@
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
index de4d200..cc0fc4b 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -639,14 +639,6 @@
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 @@
(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
index 0bdb944..af6e309 100644
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -994,6 +994,7 @@
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;