summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-10-26 06:27:24 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-10-26 06:27:24 +0000
commit1405efbe2f15d04f5b970f48c5f670bb061a730c (patch)
treefe0f15462a40dc2b9e005a943720d51fb924a193
parent66d28f5f5935601c83fd9b5e9569e87a985c82fc (diff)
nginx-0.1.4-RELEASE importrelease-0.1.4
*) Bugfix: in the ngx_http_autoindex_module.
-rw-r--r--docs/xml/nginx/changes.xml15
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/http/modules/ngx_http_autoindex_handler.c38
3 files changed, 36 insertions, 19 deletions
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 690f003a6..44293f540 100644
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -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 @@ proxy module may get caught in an endless loop when sendfile is not used.
</changes>
+
<changes ver="0.1.2" date="21.10.2004">
<change type="feature">
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);