Mercurial > hg > nginx-vendor-1-0
diff src/http/modules/ngx_http_autoindex_module.c @ 72:b31656313b59 NGINX_0_1_36
nginx 0.1.36
*) 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 <http://sysoev.ru> |
---|---|
date | Wed, 15 Jun 2005 00:00:00 +0400 |
parents | 056fd0e5a5a6 |
children | 77969b24f355 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_autoindex_module.c +++ b/src/http/modules/ngx_http_autoindex_module.c @@ -217,6 +217,16 @@ ngx_http_autoindex_handler(ngx_http_requ 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 @@ ngx_http_autoindex_handler(ngx_http_requ + 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 @@ ngx_http_autoindex_handler(ngx_http_requ 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 @@ ngx_http_autoindex_handler(ngx_http_requ 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; }