comparison src/http/modules/ngx_http_charset_filter_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 b55cbf18157e
children 77969b24f355
comparison
equal deleted inserted replaced
71:66f1f40f29d6 72:b31656313b59
10 10
11 11
12 typedef struct { 12 typedef struct {
13 char **tables; 13 char **tables;
14 ngx_str_t name; 14 ngx_str_t name;
15 ngx_uint_t server; /* unsigned server:1; */ 15
16 unsigned server:1;
17 unsigned utf8:1;
16 } ngx_http_charset_t; 18 } ngx_http_charset_t;
17 19
18 20
19 typedef struct { 21 typedef struct {
20 ngx_int_t src; 22 ngx_int_t src;
21 ngx_int_t dst; 23 ngx_int_t dst;
22 char *src2dst; 24 char *src2dst;
23 char *dst2src; 25 char *dst2src;
24 } ngx_http_charset_tables_t; 26 } ngx_http_charset_tables_t;
25 27
26 28
27 typedef struct { 29 typedef struct {
28 ngx_array_t charsets; /* ngx_http_charset_t */ 30 ngx_array_t charsets; /* ngx_http_charset_t */
29 ngx_array_t tables; /* ngx_http_charset_tables_t */ 31 ngx_array_t tables; /* ngx_http_charset_tables_t */
30 } ngx_http_charset_main_conf_t; 32 } ngx_http_charset_main_conf_t;
31 33
32 34
33 typedef struct { 35 typedef struct {
34 ngx_flag_t enable; 36 ngx_flag_t enable;
35 ngx_flag_t autodetect; 37 ngx_flag_t autodetect;
36 38
37 ngx_int_t default_charset; 39 ngx_int_t default_charset;
38 ngx_int_t source_charset; 40 ngx_int_t source_charset;
39 } ngx_http_charset_loc_conf_t; 41 } ngx_http_charset_loc_conf_t;
40 42
41 43
42 typedef struct { 44 typedef struct {
43 ngx_int_t server; 45 ngx_int_t server;
44 ngx_int_t client; 46 ngx_int_t client;
45 } ngx_http_charset_ctx_t; 47 } ngx_http_charset_ctx_t;
46 48
47 49
48 static ngx_uint_t ngx_charset_recode(ngx_buf_t *b, char *table); 50 static ngx_uint_t ngx_charset_recode(ngx_buf_t *b, char *table);
49 51
181 return ngx_http_next_header_filter(r); 183 return ngx_http_next_header_filter(r);
182 } 184 }
183 185
184 charsets = mcf->charsets.elts; 186 charsets = mcf->charsets.elts;
185 r->headers_out.charset = charsets[lcf->default_charset].name; 187 r->headers_out.charset = charsets[lcf->default_charset].name;
188 r->utf8 = charsets[lcf->default_charset].utf8;
186 189
187 if (lcf->default_charset == lcf->source_charset) { 190 if (lcf->default_charset == lcf->source_charset) {
188 return ngx_http_next_header_filter(r); 191 return ngx_http_next_header_filter(r);
189 } 192 }
190 193
446 449
447 c->tables = NULL; 450 c->tables = NULL;
448 c->name = *name; 451 c->name = *name;
449 c->server = 0; 452 c->server = 0;
450 453
454 if (ngx_strcasecmp(name->data, "utf-8") == 0) {
455 c->utf8 = 1;
456 }
457
451 return i; 458 return i;
452 } 459 }
453 460
454 461
455 static ngx_int_t 462 static ngx_int_t