Mercurial > hg > nginx
diff src/http/modules/ngx_http_charset_filter_module.c @ 653:7cbef16c71a1 release-0.3.48
nginx-0.3.48-RELEASE import
*) Change: now the ngx_http_charset_module works for subrequests, if
the response has no "Content-Type" header line.
*) Bugfix: if the "proxy_pass" directive has no URI part, then the
"proxy_redirect default" directive add the unnecessary slash in
start of the rewritten redirect.
*) Bugfix: the internal redirect always transform client's HTTP method
to GET, now the transformation is made for the "X-Accel-Redirect"
redirects only and if the method is not HEAD; the bug had appeared
in 0.3.42.
*) Bugfix: the ngx_http_perl_module could not be built, if the perl was
built with the threads support; the bug had appeared in 0.3.46.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 29 May 2006 17:28:12 +0000 |
parents | 18268abd340c |
children | 400711951595 |
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 @@ -154,7 +154,7 @@ ngx_http_charset_header_filter(ngx_http_ ngx_uint_t i; ngx_http_charset_t *charsets; ngx_http_charset_ctx_t *ctx; - ngx_http_charset_loc_conf_t *lcf; + ngx_http_charset_loc_conf_t *lcf, *mlcf; ngx_http_charset_main_conf_t *mcf; mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module); @@ -162,9 +162,9 @@ ngx_http_charset_header_filter(ngx_http_ ctx = ngx_http_get_module_ctx(r->main, ngx_http_charset_filter_module); if (ctx == NULL) { - lcf = ngx_http_get_module_loc_conf(r->main, - ngx_http_charset_filter_module); - charset = lcf->charset; + mlcf = ngx_http_get_module_loc_conf(r->main, + ngx_http_charset_filter_module); + charset = mlcf->charset; if (charset == NGX_HTTP_NO_CHARSET) { return ngx_http_next_header_filter(r); @@ -174,19 +174,30 @@ ngx_http_charset_header_filter(ngx_http_ charset = ctx->charset; } - if (r->headers_out.content_type.len == 0) { - return ngx_http_next_header_filter(r); - } + charsets = mcf->charsets.elts; + + if (r == r->main) { + if (r->headers_out.content_type.len == 0) { + return ngx_http_next_header_filter(r); + } - if (ngx_strncasecmp(r->headers_out.content_type.data, "text/", 5) != 0 - && ngx_strncasecmp(r->headers_out.content_type.data, - "application/x-javascript", 24) != 0) - { - return ngx_http_next_header_filter(r); + if (ngx_strncasecmp(r->headers_out.content_type.data, "text/", 5) != 0 + && ngx_strncasecmp(r->headers_out.content_type.data, + "application/x-javascript", 24) != 0) + { + return ngx_http_next_header_filter(r); + } + + } else { + if (r->headers_out.content_type.len == 0) { + mlcf = ngx_http_get_module_loc_conf(r->main, + ngx_http_charset_filter_module); + source_charset = mlcf->source_charset; + + goto found; + } } - charsets = mcf->charsets.elts; - lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module); len = 0;