diff options
author | Igor Sysoev <igor@sysoev.ru> | 2008-07-07 13:26:13 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2008-07-07 13:26:13 +0400 |
commit | edf1c8c1b8a83a6592714516499a18adc830eeae (patch) | |
tree | 01983bdab8428b3647f52d14fa098140070a7389 /src | |
parent | 4f677fd20377230cf959cddb39ceb4d566ce4866 (diff) |
always test root existence for access_log with variables
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_flv_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_gzip_static_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_log_module.c | 23 | ||||
-rw-r--r-- | src/http/modules/ngx_http_static_module.c | 2 | ||||
-rw-r--r-- | src/http/ngx_http_request.h | 1 |
5 files changed, 26 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c index a8239f16e..235ccddea 100644 --- a/src/http/modules/ngx_http_flv_module.c +++ b/src/http/modules/ngx_http_flv_module.c @@ -159,6 +159,8 @@ ngx_http_flv_handler(ngx_http_request_t *r) return NGX_DECLINED; } + r->root_tested = 1; + start = 0; len = of.size; i = 1; diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c index 41ac0d3ee..51fe0d56d 100644 --- a/src/http/modules/ngx_http_gzip_static_module.c +++ b/src/http/modules/ngx_http_gzip_static_module.c @@ -175,6 +175,8 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r) #endif + r->root_tested = 1; + rc = ngx_http_discard_request_body(r); if (rc != NGX_OK) { diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c index ce7559753..5b8adc595 100644 --- a/src/http/modules/ngx_http_log_module.c +++ b/src/http/modules/ngx_http_log_module.c @@ -366,7 +366,7 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script, 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 @@ ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script, 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; } } diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c index f5d697101..ce2f0fc65 100644 --- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c @@ -140,6 +140,8 @@ ngx_http_static_handler(ngx_http_request_t *r) 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) { diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index 1a4eae106..be22db636 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -469,6 +469,7 @@ struct ngx_http_request_s { unsigned request_output:1; unsigned header_sent:1; unsigned expect_tested:1; + unsigned root_tested:1; unsigned done:1; unsigned utf8:1; |