diff src/http/modules/ngx_http_autoindex_module.c @ 96:ca4f70b3ccc6 NGINX_0_2_2

nginx 0.2.2 *) Feature: the "config errmsg" command of the ngx_http_ssi_module. *) Change: the ngx_http_geo_module variables can be overridden by the "set" directive. *) Feature: the "ssl_protocols" and "ssl_prefer_server_ciphers" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; *) Bugfix: the ngx_http_autoindex_module now do not show the files starting by dot. *) Bugfix: if the SSL handshake failed then another connection may be closed too. Thanks to Rob Mueller. *) Bugfix: the export versions of MSIE 5.x could not connect via HTTPS.
author Igor Sysoev <http://sysoev.ru>
date Fri, 30 Sep 2005 00:00:00 +0400
parents 45945fa8b8ba
children f63280c59dd5
line wrap: on
line diff
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -271,21 +271,14 @@ ngx_http_autoindex_handler(ngx_http_requ
 
         len = ngx_de_namelen(&dir);
 
-        if (len == 1 && ngx_de_name(&dir)[0] == '.') {
-            continue;
-        }
-
-        if (len == 2
-            && ngx_de_name(&dir)[0] == '.'
-            && ngx_de_name(&dir)[1] == '.')
-        {
+        if (ngx_de_name(&dir)[0] == '.') {
             continue;
         }
 
         if (!dir.valid_info) {
 
-            if (dname.len + 1 + len > fname.len) {
-                fname.len = dname.len + 1 + len + 32;
+            if (dname.len + 1 + len + 1 > fname.len) {
+                fname.len = dname.len + 1 + len + 1 + 32;
 
                 fname.data = ngx_palloc(pool, fname.len);
                 if (fname.data == NULL) {
@@ -468,7 +461,8 @@ ngx_http_autoindex_handler(ngx_http_requ
 
         } else {
             if (entry[i].dir) {
-                b->last = ngx_cpymem(b->last,  "     -", sizeof("     -") - 1);
+                b->last = ngx_cpymem(b->last,  "      -",
+                                     sizeof("      -") - 1);
 
             } else {
                 length = entry[i].size;
@@ -498,13 +492,14 @@ ngx_http_autoindex_handler(ngx_http_requ
 
                 } else {
                     size = (ngx_int_t) length;
-                    scale = ' ';
+                    scale = '\0';
                 }
 
-                b->last = ngx_sprintf(b->last, "%6i", size);
+                if (scale) {
+                    b->last = ngx_sprintf(b->last, "%6i%c", size, scale);
 
-                if (scale != ' ') {
-                    *b->last++ = scale;
+                } else {
+                    b->last = ngx_sprintf(b->last, " %6i", size);
                 }
             }
         }