summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-10-26 06:31:11 +0000
committerJonathan Kolb <jon@b0g.us>2004-10-26 06:31:11 +0000
commit4778f02ca6d950751fcc59b55ff1c44a5eba528c (patch)
tree73a01106abdabf6848e12a29365bc0afb501107a
parent97037d1561937dbd6d738dfce58613349c98eb5a (diff)
downloadnginx-4778f02ca6d950751fcc59b55ff1c44a5eba528c.tar.gz
Changes with nginx 0.1.4 26 Oct 2004v0.1.4
*) Bugfix: in the ngx_http_autoindex_module.
-rw-r--r--CHANGES5
-rw-r--r--CHANGES.ru5
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/http/modules/ngx_http_autoindex_handler.c38
4 files changed, 31 insertions, 19 deletions
diff --git a/CHANGES b/CHANGES
index 6e1ac421f..b8ac74f38 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,9 @@
+Changes with nginx 0.1.4 26 Oct 2004
+
+ *) Bugfix: in the ngx_http_autoindex_module.
+
+
Changes with nginx 0.1.3 25 Oct 2004
*) Feature: the ngx_http_autoindex_module and the autoindex directive.
diff --git a/CHANGES.ru b/CHANGES.ru
index b12d433f3..03dab9d14 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,9 @@
+Изменения в nginx 0.1.4 26.10.2004
+
+ *) Исправление: ошибка в модуле ngx_http_autoindex_module.
+
+
Изменения в nginx 0.1.3 25.10.2004
*) Добавление: модуль ngx_http_autoindex_module и директива autoindex.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 04282efa4..0d42998f4 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -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"
diff --git a/src/http/modules/ngx_http_autoindex_handler.c b/src/http/modules/ngx_http_autoindex_handler.c
index 5f1726efc..99aa35d88 100644
--- a/src/http/modules/ngx_http_autoindex_handler.c
+++ b/src/http/modules/ngx_http_autoindex_handler.c
@@ -230,6 +230,17 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r)
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 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r)
}
}
- 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 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r)
} 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 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r)
*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);