diff src/http/ngx_http_header_filter_module.c @ 657:400711951595 release-0.3.50

nginx-0.3.50-RELEASE import *) Change: the "proxy_redirect_errors" and "fastcgi_redirect_errors" directives was renamed to the "proxy_intercept_errors" and "fastcgi_intercept_errors" directives. *) Feature: the ngx_http_charset_module supports the recoding from the single byte encodings to the UTF-8 encoding and back. *) Feature: the "X-Accel-Charset" response header line is supported in proxy and FastCGI mode. *) Bugfix: the "\" escape symbol in the "\"" and "\'" pairs in the SSI command was removed only if the command also has the "$" symbol. *) Bugfix: the "<!--" string might be added on some conditions in the SSI after inclusion. *) Bugfix: if the "Content-Length: 0" header line was in response, then in nonbuffered proxying mode the client connection was not closed.
author Igor Sysoev <igor@sysoev.ru>
date Wed, 28 Jun 2006 16:00:26 +0000
parents e60fe4cf1d4e
children 6d5c1535bb9d
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -247,7 +247,9 @@ ngx_http_header_filter(ngx_http_request_
         len += sizeof("Content-Type: ") - 1
                + r->headers_out.content_type.len + 2;
 
-        if (r->headers_out.charset.len) {
+        if (r->headers_out.content_type_len == r->headers_out.content_type.len
+            && r->headers_out.charset.len)
+        {
             len += sizeof("; charset=") - 1 + r->headers_out.charset.len;
         }
     }
@@ -380,7 +382,9 @@ ngx_http_header_filter(ngx_http_request_
         b->last = ngx_copy(b->last, r->headers_out.content_type.data,
                            r->headers_out.content_type.len);
 
-        if (r->headers_out.charset.len) {
+        if (r->headers_out.content_type_len == r->headers_out.content_type.len
+            && r->headers_out.charset.len)
+        {
             b->last = ngx_cpymem(b->last, "; charset=",
                                  sizeof("; charset=") - 1);
             b->last = ngx_copy(b->last, r->headers_out.charset.data,