comparison src/http/modules/ngx_http_charset_filter_module.c @ 202:ca5f86d94316 NGINX_0_3_48

nginx 0.3.48 *) 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; bug appeared in 0.3.42. *) Bugfix: the ngx_http_perl_module could not be built, if the perl was built with the threads support; bug appeared in 0.3.46.
author Igor Sysoev <http://sysoev.ru>
date Mon, 29 May 2006 00:00:00 +0400
parents 71ff1e2b484a
children 3866d57d9cfd
comparison
equal deleted inserted replaced
201:958c1992c173 202:ca5f86d94316
152 u_char *p; 152 u_char *p;
153 ngx_int_t charset, source_charset; 153 ngx_int_t charset, source_charset;
154 ngx_uint_t i; 154 ngx_uint_t i;
155 ngx_http_charset_t *charsets; 155 ngx_http_charset_t *charsets;
156 ngx_http_charset_ctx_t *ctx; 156 ngx_http_charset_ctx_t *ctx;
157 ngx_http_charset_loc_conf_t *lcf; 157 ngx_http_charset_loc_conf_t *lcf, *mlcf;
158 ngx_http_charset_main_conf_t *mcf; 158 ngx_http_charset_main_conf_t *mcf;
159 159
160 mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module); 160 mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
161 161
162 ctx = ngx_http_get_module_ctx(r->main, ngx_http_charset_filter_module); 162 ctx = ngx_http_get_module_ctx(r->main, ngx_http_charset_filter_module);
163 163
164 if (ctx == NULL) { 164 if (ctx == NULL) {
165 lcf = ngx_http_get_module_loc_conf(r->main, 165 mlcf = ngx_http_get_module_loc_conf(r->main,
166 ngx_http_charset_filter_module); 166 ngx_http_charset_filter_module);
167 charset = lcf->charset; 167 charset = mlcf->charset;
168 168
169 if (charset == NGX_HTTP_NO_CHARSET) { 169 if (charset == NGX_HTTP_NO_CHARSET) {
170 return ngx_http_next_header_filter(r); 170 return ngx_http_next_header_filter(r);
171 } 171 }
172 172
173 } else { 173 } else {
174 charset = ctx->charset; 174 charset = ctx->charset;
175 } 175 }
176 176
177 if (r->headers_out.content_type.len == 0) {
178 return ngx_http_next_header_filter(r);
179 }
180
181 if (ngx_strncasecmp(r->headers_out.content_type.data, "text/", 5) != 0
182 && ngx_strncasecmp(r->headers_out.content_type.data,
183 "application/x-javascript", 24) != 0)
184 {
185 return ngx_http_next_header_filter(r);
186 }
187
188 charsets = mcf->charsets.elts; 177 charsets = mcf->charsets.elts;
178
179 if (r == r->main) {
180 if (r->headers_out.content_type.len == 0) {
181 return ngx_http_next_header_filter(r);
182 }
183
184 if (ngx_strncasecmp(r->headers_out.content_type.data, "text/", 5) != 0
185 && ngx_strncasecmp(r->headers_out.content_type.data,
186 "application/x-javascript", 24) != 0)
187 {
188 return ngx_http_next_header_filter(r);
189 }
190
191 } else {
192 if (r->headers_out.content_type.len == 0) {
193 mlcf = ngx_http_get_module_loc_conf(r->main,
194 ngx_http_charset_filter_module);
195 source_charset = mlcf->source_charset;
196
197 goto found;
198 }
199 }
189 200
190 lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module); 201 lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
191 202
192 len = 0; 203 len = 0;
193 204