]> git.kaiwu.me - nginx.git/commitdiff
fix autoindex for "alias /"
authorIgor Sysoev <igor@sysoev.ru>
Thu, 8 Nov 2007 15:21:54 +0000 (15:21 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 8 Nov 2007 15:21:54 +0000 (15:21 +0000)
src/http/modules/ngx_http_autoindex_module.c
src/http/modules/ngx_http_index_module.c

index ae9eaabbb058d248edf99017723b4ecbe03c76cd..f57fbc87d91f7886ed2fbb48d2a3d1e154ca85e3 100644 (file)
@@ -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,
index eac68e1555c9181a280c16876d2d7b254a7ce19e..7eeaf0a90d0a5463f92400b1559a8cc2efbcd268 100644 (file)
@@ -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);
     }