comparison src/http/modules/ngx_http_charset_filter.c @ 307:ce375c313e96

nginx-0.0.3-2004-04-08-19:58:25 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 08 Apr 2004 15:58:25 +0000
parents 4db54fdbcbe7
children 0376cffa29e6
comparison
equal deleted inserted replaced
306:6b91bfbc4123 307:ce375c313e96
60 60
61 static int ngx_http_charset_header_filter(ngx_http_request_t *r) 61 static int ngx_http_charset_header_filter(ngx_http_request_t *r)
62 { 62 {
63 ngx_http_charset_loc_conf_t *lcf; 63 ngx_http_charset_loc_conf_t *lcf;
64 64
65 lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
66
67 if (lcf->default_charset.len == 0) {
68 return ngx_http_next_header_filter(r);
69 }
70
65 if (r->headers_out.content_type == NULL 71 if (r->headers_out.content_type == NULL
66 || ngx_strncasecmp(r->headers_out.content_type->value.data, 72 || ngx_strncasecmp(r->headers_out.content_type->value.data,
67 "text/", 5) != 0 73 "text/", 5) != 0
68 || ngx_strstr(r->headers_out.content_type->value.data, "charset") 74 || ngx_strstr(r->headers_out.content_type->value.data, "charset")
69 != NULL 75 != NULL
70 ) 76 )
71 { 77 {
72 return ngx_http_next_header_filter(r); 78 return ngx_http_next_header_filter(r);
73 } 79 }
74
75 lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
76 80
77 if (r->headers_out.status == NGX_HTTP_MOVED_PERMANENTLY 81 if (r->headers_out.status == NGX_HTTP_MOVED_PERMANENTLY
78 && r->headers_out.status == NGX_HTTP_MOVED_TEMPORARILY) 82 && r->headers_out.status == NGX_HTTP_MOVED_TEMPORARILY)
79 { 83 {
80 84
133 { 137 {
134 ngx_http_charset_loc_conf_t *prev = parent; 138 ngx_http_charset_loc_conf_t *prev = parent;
135 ngx_http_charset_loc_conf_t *conf = child; 139 ngx_http_charset_loc_conf_t *conf = child;
136 140
137 ngx_conf_merge_str_value(conf->default_charset, 141 ngx_conf_merge_str_value(conf->default_charset,
138 prev->default_charset, "koi8-r"); 142 prev->default_charset, "");
139 143
140 return NGX_CONF_OK; 144 return NGX_CONF_OK;
141 } 145 }