diff options
Diffstat (limited to 'src/http/modules/ngx_http_autoindex_handler.c')
-rw-r--r-- | src/http/modules/ngx_http_autoindex_handler.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_autoindex_handler.c b/src/http/modules/ngx_http_autoindex_handler.c index 2e555a058..f7878c9b9 100644 --- a/src/http/modules/ngx_http_autoindex_handler.c +++ b/src/http/modules/ngx_http_autoindex_handler.c @@ -241,7 +241,7 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) if (len == 2 && ngx_de_name(&dir)[0] == '.' - && ngx_de_name(&dir)[0] == '.') + && ngx_de_name(&dir)[1] == '.') { continue; } @@ -263,9 +263,20 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) ngx_cpystrn(last, ngx_de_name(&dir), len + 1); if (ngx_de_info(fname.data, &dir) == NGX_FILE_ERROR) { - ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, - ngx_de_info_n " \"%s\" failed", fname.data); - return ngx_http_autoindex_error(r, &dir, dname.data); + err = ngx_errno; + + if (err != NGX_ENOENT) { + ngx_log_error(NGX_LOG_CRIT, r->connection->log, err, + ngx_de_info_n " \"%s\" failed", fname.data); + return ngx_http_autoindex_error(r, &dir, dname.data); + } + + if (ngx_de_link_info(fname.data, &dir) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, + ngx_de_link_info_n " \"%s\" failed", + fname.data); + return ngx_http_autoindex_error(r, &dir, dname.data); + } } } |