diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-06-15 22:33:41 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-06-15 22:33:41 +0400 |
commit | b145b067e296fd0c72d764e36db7a97102045b2c (patch) | |
tree | 1604c71100a9ea0dc0be0f848ed7ed9dc7108843 /src/http/modules | |
parent | e08f105e27475ea77f5ceb39fc76d9cb2ba078d1 (diff) |
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')
-rw-r--r-- | src/http/modules/ngx_http_autoindex_module.c | 31 | ||||
-rw-r--r-- | src/http/modules/ngx_http_charset_filter_module.c | 29 |
2 files changed, 37 insertions, 23 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; } diff --git a/src/http/modules/ngx_http_charset_filter_module.c b/src/http/modules/ngx_http_charset_filter_module.c index 0c76a5f43..117281ca2 100644 --- a/src/http/modules/ngx_http_charset_filter_module.c +++ b/src/http/modules/ngx_http_charset_filter_module.c @@ -12,15 +12,17 @@ typedef struct { char **tables; ngx_str_t name; - ngx_uint_t server; /* unsigned server:1; */ + + unsigned server:1; + unsigned utf8:1; } ngx_http_charset_t; typedef struct { - ngx_int_t src; - ngx_int_t dst; - char *src2dst; - char *dst2src; + ngx_int_t src; + ngx_int_t dst; + char *src2dst; + char *dst2src; } ngx_http_charset_tables_t; @@ -31,17 +33,17 @@ typedef struct { typedef struct { - ngx_flag_t enable; - ngx_flag_t autodetect; + ngx_flag_t enable; + ngx_flag_t autodetect; - ngx_int_t default_charset; - ngx_int_t source_charset; + ngx_int_t default_charset; + ngx_int_t source_charset; } ngx_http_charset_loc_conf_t; typedef struct { - ngx_int_t server; - ngx_int_t client; + ngx_int_t server; + ngx_int_t client; } ngx_http_charset_ctx_t; @@ -183,6 +185,7 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) charsets = mcf->charsets.elts; r->headers_out.charset = charsets[lcf->default_charset].name; + r->utf8 = charsets[lcf->default_charset].utf8; if (lcf->default_charset == lcf->source_charset) { return ngx_http_next_header_filter(r); @@ -448,6 +451,10 @@ ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name) c->name = *name; c->server = 0; + if (ngx_strcasecmp(name->data, "utf-8") == 0) { + c->utf8 = 1; + } + return i; } |