Mercurial > hg > nginx
changeset 459:0491b909ef76 release-0.1.4
nginx-0.1.4-RELEASE import
*) Bugfix: in the ngx_http_autoindex_module.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 26 Oct 2004 06:27:24 +0000 |
parents | e0152b9ab98b |
children | 5f8319142dfc |
files | docs/xml/nginx/changes.xml src/core/nginx.h src/http/modules/ngx_http_autoindex_handler.c |
diffstat | 3 files changed, 36 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/xml/nginx/changes.xml Mon Oct 25 15:29:23 2004 +0000 +++ b/docs/xml/nginx/changes.xml Tue Oct 26 06:27:24 2004 +0000 @@ -6,6 +6,20 @@ title="nginx"> +<changes ver="0.1.4" date="26.10.2004"> + +<change type="bugfix"> +<para lang="ru"> +ошибка в модуле ngx_http_autoindex_module. +</para> +<para lang="en"> +in the ngx_http_autoindex_module. +</para> +</change> + +</changes> + + <changes ver="0.1.3" date="25.10.2004"> <change type="feature"> @@ -38,6 +52,7 @@ </changes> + <changes ver="0.1.2" date="21.10.2004"> <change type="feature">
--- a/src/core/nginx.h Mon Oct 25 15:29:23 2004 +0000 +++ b/src/core/nginx.h Tue Oct 26 06:27:24 2004 +0000 @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.1.3" +#define NGINX_VER "nginx/0.1.4" #define NGINX_VAR "NGINX" #define NGX_NEWPID_EXT ".newbin"
--- a/src/http/modules/ngx_http_autoindex_handler.c Mon Oct 25 15:29:23 2004 +0000 +++ b/src/http/modules/ngx_http_autoindex_handler.c Tue Oct 26 06:27:24 2004 +0000 @@ -230,6 +230,17 @@ 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)[0] == '.') + { + continue; + } + if (!dir.valid_info) { if (dname.len + 1 + len > fname.len) { @@ -253,17 +264,6 @@ } } - if (len == 1 && ngx_de_name(&dir)[0] == '.') { - continue; - } - - if (len == 2 - && ngx_de_name(&dir)[0] == '.' - && ngx_de_name(&dir)[0] == '.') - { - continue; - } - if (!(entry = ngx_array_push(&entries))) { return ngx_http_autoindex_error(r, &dir, dname.data); } @@ -375,24 +375,24 @@ } else { length = entry[i].size; - if (length > 999999999) { - size = (ngx_int_t) length / 1024 * 1024 * 1024; - if ((length % 1024 * 1024 * 1024) + if (length > 1024 * 1024 * 1024) { + size = (ngx_int_t) (length / (1024 * 1024 * 1024)); + if ((length % (1024 * 1024 * 1024)) > (1024 * 1024 * 1024 / 2 - 1)) { size++; } scale = 'G'; - } else if (length > 999999) { - size = (ngx_int_t) length / 1024 * 1024; - if ((length % 1024 * 1024) > (1024 * 1024 / 2 - 1)) { + } else if (length > 1024 * 1024) { + size = (ngx_int_t) (length / (1024 * 1024)); + if ((length % (1024 * 1024)) > (1024 * 1024 / 2 - 1)) { size++; } scale = 'M'; } else if (length > 9999) { - size = (ngx_int_t) length / 1024; + size = (ngx_int_t) (length / 1024); if (length % 1024 > 511) { size++; } @@ -414,6 +414,8 @@ *b->last++ = LF; } + /* TODO: free temporary pool */ + b->last = ngx_cpymem(b->last, "</pre><hr>", sizeof("</pre><hr>") - 1); b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1);