diff options
author | Roman Arutyunyan <arut@nginx.com> | 2015-02-02 19:38:32 +0300 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2015-02-02 19:38:32 +0300 |
commit | 54e14a387fe0b18dc3e607effef26603a32cacf5 (patch) | |
tree | edf9e2b810aa99b0ad8a8f0a159ef362e7da171a | |
parent | 314d0d40e75498431ab4d0bc772a41957fb6736c (diff) |
Core: supported directory skipping in ngx_walk_tree().
If pre_tree_handler() returns NGX_DECLINED, the directory is ignored.
-rw-r--r-- | src/core/ngx_file.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c index 8657d69ed..dc2259634 100644 --- a/src/core/ngx_file.c +++ b/src/core/ngx_file.c @@ -1047,10 +1047,18 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree) ctx->access = ngx_de_access(&dir); ctx->mtime = ngx_de_mtime(&dir); - if (ctx->pre_tree_handler(ctx, &file) == NGX_ABORT) { + rc = ctx->pre_tree_handler(ctx, &file); + + if (rc == NGX_ABORT) { goto failed; } + if (rc == NGX_DECLINED) { + ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0, + "tree skip dir \"%s\"", file.data); + continue; + } + if (ngx_walk_tree(ctx, &file) == NGX_ABORT) { goto failed; } |