Mercurial > hg > nginx-vendor-0-7
diff src/http/modules/ngx_http_charset_filter_module.c @ 212:56688ed172c8 NGINX_0_3_53
nginx 0.3.53
*) Change: the "add_header" directive adds the string to 204, 301, and
302 responses.
*) Feature: the "server" directive in the "upstream" context supports
the "weight" parameter.
*) Feature: the "server_name" directive supports the "*" wildcard.
*) Feature: nginx supports the request body size more than 2G.
*) Bugfix: if a client was successfully authorized using "satisfy_any
on", then anyway the message "access forbidden by rule" was written
in the log.
*) Bugfix: the "PUT" method may erroneously not create a file and
return the 409 code.
*) Bugfix: if the IMAP/POP3 backend returned an error, then nginx
continued proxying anyway.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 07 Jul 2006 00:00:00 +0400 |
parents | 14050d2bec9b |
children | 0ad9eeb6ac7f |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_charset_filter_module.c +++ b/src/http/modules/ngx_http_charset_filter_module.c @@ -188,7 +188,7 @@ ngx_http_charset_header_filter(ngx_http_ { u_char *ct; ngx_int_t charset, source_charset; - ngx_str_t *mc; + ngx_str_t *mc, *from, *to; ngx_uint_t n; ngx_http_charset_t *charsets; ngx_http_charset_ctx_t *ctx; @@ -288,13 +288,10 @@ ngx_http_charset_header_filter(ngx_http_ return ngx_http_next_header_filter(r); } - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no \"charset_map\" between the charsets " - "\"%V\" and \"%V\"", - &charsets[lcf->source_charset].name, - &r->main->headers_out.charset); + from = &charsets[lcf->source_charset].name; + to = &r->main->headers_out.charset; - return ngx_http_next_header_filter(r); + goto no_charset_map; } source_charset = ngx_http_charset_get_charset(charsets, n, @@ -308,11 +305,12 @@ ngx_http_charset_header_filter(ngx_http_ r->headers_out.charset.data) != 0) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no \"charset_map\" between the charsets " - "\"%V\" and \"%V\"", - &r->headers_out.charset, - &r->main->headers_out.charset); + from = &r->headers_out.charset; + to = (charset == NGX_HTTP_NO_CHARSET) ? + &r->main->headers_out.charset: + &charsets[charset].name; + + goto no_charset_map; } return ngx_http_next_header_filter(r); @@ -322,18 +320,24 @@ ngx_http_charset_header_filter(ngx_http_ && (charsets[source_charset].tables == NULL || charsets[source_charset].tables[charset] == NULL)) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no \"charset_map\" between the charsets " - "\"%V\" and \"%V\"", - &charsets[source_charset].name, &charsets[charset].name); + from = &charsets[source_charset].name; + to = &charsets[charset].name; - return ngx_http_next_header_filter(r); + goto no_charset_map; } r->headers_out.content_type.len = r->headers_out.content_type_len; return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset, source_charset); + +no_charset_map: + + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "no \"charset_map\" between the charsets " + "\"%V\" and \"%V\"", from, to); + + return ngx_http_next_header_filter(r); } @@ -392,12 +396,15 @@ ngx_http_charset_set_charset(ngx_http_re ctx->from_utf8 = charsets[source_charset].utf8; ctx->to_utf8 = charsets[charset].utf8; + r->filter_need_in_memory = 1; + if ((ctx->to_utf8 || ctx->from_utf8) && r == r->main) { ngx_http_clear_content_length(r); + + } else { + r->filter_need_temporary = 1; } - r->filter_need_in_memory = 1; - return ngx_http_next_header_filter(r); }