Mercurial > hg > nginx
diff src/http/modules/ngx_http_autoindex_module.c @ 523:2019117e6b38 release-0.1.36
nginx-0.1.36-RELEASE import
*) Change: if the request header has duplicate the "Host",
"Connection", "Content-Length", or "Authorization" lines, then nginx
now returns the 400 error.
*) Change: the "post_accept_timeout" directive was canceled.
*) Feature: the "default", "af=", "bl=", "deferred", and "bind"
parameters of the "listen" directive.
*) Feature: the FreeBSD accept filters support.
*) Feature: the Linux TCP_DEFER_ACCEPT support.
*) Bugfix: the ngx_http_autoindex_module did not support the file names
in UTF-8.
*) Bugfix: the new log file can be rotated by the -USR1 signal only if
the reconfiguration by the -HUP signal was made twice.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 15 Jun 2005 18:33:41 +0000 |
parents | 12234c998d83 |
children | 09b42134ac0c |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_autoindex_module.c Tue Jun 07 15:56:31 2005 +0000 +++ b/src/http/modules/ngx_http_autoindex_module.c Wed Jun 15 18:33:41 2005 +0000 @@ -217,6 +217,16 @@ return ngx_http_autoindex_error(r, &dir, dname.data); } + r->headers_out.status = NGX_HTTP_OK; + r->headers_out.content_type.len = sizeof("text/html") - 1; + r->headers_out.content_type.data = (u_char *) "text/html"; + + rc = ngx_http_send_header(r); + + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + fname.len = 0; #if (NGX_SUPPRESS_WARN) fname.data = NULL; @@ -334,6 +344,10 @@ + sizeof(" 28-Sep-1970 12:00 ") - 1 + 19 + 2; + + if (r->utf8) { + len += entry[i].name.len - ngx_utf_length(&entry[i].name); + } } b = ngx_create_temp_buf(r->pool, len); @@ -380,7 +394,11 @@ b->last = ngx_cpystrn(b->last, entry[i].name.data, NGX_HTTP_AUTOINDEX_NAME_LEN + 1); - len = entry[i].name.len; + if (r->utf8) { + len = ngx_utf_length(&entry[i].name); + } else { + len = entry[i].name.len; + } if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { b->last = ngx_cpymem(b->last - 3, "..></a>", @@ -426,17 +444,6 @@ b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1); - r->headers_out.status = NGX_HTTP_OK; - r->headers_out.content_length_n = b->last - b->pos; - r->headers_out.content_type.len = sizeof("text/html") - 1; - r->headers_out.content_type.data = (u_char *) "text/html"; - - rc = ngx_http_send_header(r); - - if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { - return rc; - } - if (r->main == NULL) { b->last_buf = 1; }