changeset 1627:bf5521329069

fix autoindex for "alias /"
author Igor Sysoev <igor@sysoev.ru>
date Thu, 08 Nov 2007 15:21:54 +0000
parents 7caa66b819df
children 8d3d224cae20
files src/http/modules/ngx_http_autoindex_module.c src/http/modules/ngx_http_index_module.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_autoindex_module.c	Thu Nov 08 15:21:22 2007 +0000
+++ b/src/http/modules/ngx_http_autoindex_module.c	Thu Nov 08 15:21:54 2007 +0000
@@ -181,7 +181,10 @@
     }
 
     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,
--- a/src/http/modules/ngx_http_index_module.c	Thu Nov 08 15:21:22 2007 +0000
+++ b/src/http/modules/ngx_http_index_module.c	Thu Nov 08 15:21:54 2007 +0000
@@ -279,7 +279,7 @@
     ngx_open_file_info_t  of;
 
     c = *last;
-    if (c != '/') {
+    if (c != '/' || path == last) {
         /* "alias" without trailing slash */
         c = *(++last);
     }