diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-06-15 18:33:41 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-06-15 18:33:41 +0000 |
commit | b145b067e296fd0c72d764e36db7a97102045b2c (patch) | |
tree | 1604c71100a9ea0dc0be0f848ed7ed9dc7108843 /src/http/modules/ngx_http_autoindex_module.c | |
parent | e08f105e27475ea77f5ceb39fc76d9cb2ba078d1 (diff) | |
download | nginx-release-0.1.36.tar.gz nginx-release-0.1.36.zip |
nginx-0.1.36-RELEASE importrelease-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.
Diffstat (limited to 'src/http/modules/ngx_http_autoindex_module.c')
-rw-r--r-- | src/http/modules/ngx_http_autoindex_module.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c index 96ab81e48..ab4418f9b 100644 --- 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_request_t *r) 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_request_t *r) + 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_request_t *r) 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_request_t *r) 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; } |