Maxim Dounin
May 11, 2012 03:12AM
Hello!

On Thu, May 10, 2012 at 04:36:46PM -0400, djeps wrote:

> Yes, you're correct Maxim, I've a WURFL-based caching system that
> handles content compression.
>
> If I understand you correctly, the headers nginx receive from the
> upstream proxied server are sent without avail of the 'charset utf-8;'
> directive in nginx.
>
> I was wondering If nginx without third party modules would be able to
> append the charset portion of the Content-Type header with the correct
> charset. But then, the answer is no.

Ah, ok, you are trying to use the "charset" directive to add
charset, but it doesn't work with gzipped content, right?

This is indeed looks like a problem: charset module ignores
gzipped content, as it assumes it can't recode it anyway, and it
doesn't check if it really needs to recode anything. This should
be fixed to still allow it to set charset if no recode needed.

You may try the following patch:

--- a/src/http/modules/ngx_http_charset_filter_module.c
+++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -258,6 +258,13 @@ ngx_http_charset_header_filter(ngx_http_
return ngx_http_next_header_filter(r);
}

+ if (!r->ignore_content_encoding
+ && r->headers_out.content_encoding
+ && r->headers_out.content_encoding->value.len)
+ {
+ return ngx_http_next_header_filter(r);
+ }
+
if (charset == NGX_HTTP_NO_CHARSET
|| source_charset == NGX_HTTP_NO_CHARSET)
{
@@ -311,13 +318,6 @@ ngx_http_destination_charset(ngx_http_re
ngx_http_charset_loc_conf_t *mlcf;
ngx_http_charset_main_conf_t *mcf;

- if (!r->ignore_content_encoding
- && r->headers_out.content_encoding
- && r->headers_out.content_encoding->value.len)
- {
- return NGX_DECLINED;
- }
-
if (r->headers_out.content_type.len == 0) {
return NGX_DECLINED;
}


Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

content-type header charset info problem

djeps May 10, 2012 11:51AM

Re: content-type header charset info problem

Maxim Dounin May 10, 2012 02:36PM

Re: content-type header charset info problem

djeps May 10, 2012 04:36PM

Re: content-type header charset info problem

Maxim Dounin May 11, 2012 03:12AM

Re: content-type header charset info problem

djeps May 11, 2012 10:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 278
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready