aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_autoindex_module.c5
-rw-r--r--src/http/modules/ngx_http_index_module.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c
index ae9eaabbb..f57fbc87d 100644
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -181,7 +181,10 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
}
allocated = path.len;
- path.len = last - path.data - 1;
+ path.len = last - path.data;
+ if (path.len > 1) {
+ path.len--;
+ }
path.data[path.len] = '\0';
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c
index eac68e155..7eeaf0a90 100644
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -279,7 +279,7 @@ ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_core_loc_conf_t *clcf,
ngx_open_file_info_t of;
c = *last;
- if (c != '/') {
+ if (c != '/' || path == last) {
/* "alias" without trailing slash */
c = *(++last);
}