Mercurial > hg > nginx
changeset 2087:c8039b26a949
always test root existence for access_log with variables
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 07 Jul 2008 09:26:13 +0000 |
parents | 22d36702c654 |
children | c2f0f7cf306f |
files | src/http/modules/ngx_http_flv_module.c src/http/modules/ngx_http_gzip_static_module.c src/http/modules/ngx_http_log_module.c src/http/modules/ngx_http_static_module.c src/http/ngx_http_request.h |
diffstat | 5 files changed, 26 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_flv_module.c Fri Jul 04 12:59:53 2008 +0000 +++ b/src/http/modules/ngx_http_flv_module.c Mon Jul 07 09:26:13 2008 +0000 @@ -159,6 +159,8 @@ return NGX_DECLINED; } + r->root_tested = 1; + start = 0; len = of.size; i = 1;
--- a/src/http/modules/ngx_http_gzip_static_module.c Fri Jul 04 12:59:53 2008 +0000 +++ b/src/http/modules/ngx_http_gzip_static_module.c Mon Jul 07 09:26:13 2008 +0000 @@ -175,6 +175,8 @@ #endif + r->root_tested = 1; + rc = ngx_http_discard_request_body(r); if (rc != NGX_OK) {
--- a/src/http/modules/ngx_http_log_module.c Fri Jul 04 12:59:53 2008 +0000 +++ b/src/http/modules/ngx_http_log_module.c Mon Jul 07 09:26:13 2008 +0000 @@ -366,7 +366,7 @@ ngx_http_log_loc_conf_t *llcf; ngx_http_core_loc_conf_t *clcf; - if (r->err_status == NGX_HTTP_NOT_FOUND) { + if (!r->root_tested) { /* test root directory existance */ @@ -387,10 +387,25 @@ of.events = clcf->open_file_cache_events; if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) - != NGX_OK - || !of.is_dir) + != NGX_OK) { - /* no root directory: simulate successfull logging */ + if (of.err == 0) { + /* simulate successfull logging */ + return len; + } + + ngx_log_error(NGX_LOG_ERR, r->connection->log, of.err, + "testing \"%s\" existence failed", path.data); + + /* simulate successfull logging */ + return len; + } + + if (!of.is_dir) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ENOTDIR, + "testing \"%s\" existence failed", path.data); + + /* simulate successfull logging */ return len; } }
--- a/src/http/modules/ngx_http_static_module.c Fri Jul 04 12:59:53 2008 +0000 +++ b/src/http/modules/ngx_http_static_module.c Mon Jul 07 09:26:13 2008 +0000 @@ -140,6 +140,8 @@ return rc; } + r->root_tested = 1; + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd); if (of.is_dir) {