Mercurial > hg > nginx
diff src/http/modules/ngx_http_charset_filter.c @ 477:ad1e9ebf93bb release-0.1.13
nginx-0.1.13-RELEASE import
*) Feature: the server_names_hash and server_names_hash_threshold
directives.
*) Bugfix: the *.domain.tld names in the "server_name" directive did
not work.
*) Bugfix: the %request_length log parameter logged the incorrect
length.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 21 Dec 2004 12:30:30 +0000 |
parents | a88a3e4e158f |
children | 64d9afb209da |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_charset_filter.c +++ b/src/http/modules/ngx_http_charset_filter.c @@ -147,12 +147,6 @@ static ngx_int_t ngx_http_charset_header return ngx_http_next_header_filter(r); } -#if 0 - if (lcf->default_charset.len == 0) { - return ngx_http_next_header_filter(r); - } -#endif - if (r->headers_out.content_type == NULL) { return ngx_http_next_header_filter(r); } @@ -559,12 +553,36 @@ static char *ngx_http_charset_merge_loc_ ngx_conf_merge_value(conf->enable, prev->enable, 0); ngx_conf_merge_value(conf->autodetect, prev->autodetect, 0); + + if (conf->default_charset == NGX_CONF_UNSET) { + conf->default_charset = prev->default_charset; + } + if (conf->source_charset == NGX_CONF_UNSET) { conf->source_charset = prev->source_charset; } - ngx_conf_merge_value(conf->default_charset, prev->default_charset, - conf->source_charset); + if (conf->default_charset == NGX_CONF_UNSET + && conf->source_charset != NGX_CONF_UNSET) + { + conf->default_charset = conf->source_charset; + } + + if (conf->source_charset == NGX_CONF_UNSET + && conf->default_charset != NGX_CONF_UNSET) + { + conf->source_charset = conf->default_charset; + } + + if (conf->enable + && (conf->default_charset == NGX_CONF_UNSET + || conf->source_charset == NGX_CONF_UNSET)) + { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "the \"source_charset\" or \"default_charset\" " + "must be specified when \"charset\" is on"); + return NGX_CONF_ERROR; + } return NGX_CONF_OK; }