comparison src/http/modules/ngx_http_charset_filter_module.c @ 210:14050d2bec9b NGINX_0_3_52

nginx 0.3.52 *) Change: the ngx_http_index_module behavior for the "POST /" requests is reverted to the 0.3.40 version state: the module now does not return the 405 error. *) Bugfix: the worker process may got caught in an endless loop if the limit rate was used; bug appeared in 0.3.37. *) Bugfix: ngx_http_charset_module logged "unknown charset" alert, even if the recoding was not needed; bug appeared in 0.3.50. *) Bugfix: if a code response of the PUT request was 409, then a temporary file was not removed.
author Igor Sysoev <http://sysoev.ru>
date Mon, 03 Jul 2006 00:00:00 +0400
parents b12b3b1a9426
children 56688ed172c8
comparison
equal deleted inserted replaced
209:10c6621dce28 210:14050d2bec9b
213 { 213 {
214 charset = ngx_http_charset_get_charset(charsets, n, 214 charset = ngx_http_charset_get_charset(charsets, n,
215 r->headers_out.override_charset->data); 215 r->headers_out.override_charset->data);
216 216
217 if (charset == NGX_HTTP_NO_CHARSET) { 217 if (charset == NGX_HTTP_NO_CHARSET) {
218 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 218 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
219 "unknown charset \"%V\" to override", 219 "unknown charset \"%V\" to override",
220 r->headers_out.override_charset); 220 r->headers_out.override_charset);
221 221
222 return ngx_http_next_header_filter(r); 222 return ngx_http_next_header_filter(r);
223 } 223 }
267 267
268 charset = ngx_http_charset_get_charset(charsets, n, mc->data); 268 charset = ngx_http_charset_get_charset(charsets, n, mc->data);
269 269
270 ctx->charset = charset; 270 ctx->charset = charset;
271 271
272 if (charset == NGX_HTTP_NO_CHARSET) { 272 } else {
273 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 273 charset = ctx->charset;
274 "unknown charset \"%V\" of main request", mc);
275
276 return ngx_http_next_header_filter(r);
277 }
278 }
279
280 charset = ctx->charset;
281
282 if (charset == NGX_HTTP_NO_CHARSET) {
283 return ngx_http_next_header_filter(r);
284 } 274 }
285 } 275 }
286 276
287 /* source charset */ 277 /* source charset */
288 278
289 if (r->headers_out.charset.len == 0) { 279 if (r->headers_out.charset.len == 0) {
290 lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module); 280 lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
291 281
292 return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset, 282 if (charset != NGX_HTTP_NO_CHARSET) {
293 lcf->source_charset); 283 return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset,
284 lcf->source_charset);
285 }
286
287 if (lcf->source_charset == NGX_CONF_UNSET) {
288 return ngx_http_next_header_filter(r);
289 }
290
291 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
292 "no \"charset_map\" between the charsets "
293 "\"%V\" and \"%V\"",
294 &charsets[lcf->source_charset].name,
295 &r->main->headers_out.charset);
296
297 return ngx_http_next_header_filter(r);
294 } 298 }
295 299
296 source_charset = ngx_http_charset_get_charset(charsets, n, 300 source_charset = ngx_http_charset_get_charset(charsets, n,
297 r->headers_out.charset.data); 301 r->headers_out.charset.data);
298 302
299 if (source_charset == NGX_HTTP_NO_CHARSET) { 303 if (charset == NGX_HTTP_NO_CHARSET
300 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 304 || source_charset == NGX_HTTP_NO_CHARSET)
301 "unknown source charset \"%V\"", &r->headers_out.charset); 305 {
306 if (charset != source_charset
307 || ngx_strcasecmp(r->main->headers_out.charset.data,
308 r->headers_out.charset.data)
309 != 0)
310 {
311 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
312 "no \"charset_map\" between the charsets "
313 "\"%V\" and \"%V\"",
314 &r->headers_out.charset,
315 &r->main->headers_out.charset);
316 }
302 317
303 return ngx_http_next_header_filter(r); 318 return ngx_http_next_header_filter(r);
304 } 319 }
305 320
306 if (source_charset != charset 321 if (source_charset != charset
307 && (charsets[source_charset].tables == NULL 322 && (charsets[source_charset].tables == NULL
308 || charsets[source_charset].tables[charset] == NULL)) 323 || charsets[source_charset].tables[charset] == NULL))
309 { 324 {
310 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 325 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
311 "no \"charset_map\" between the charsets " 326 "no \"charset_map\" between the charsets "
312 "\"%V\" and \"%V\"", 327 "\"%V\" and \"%V\"",
313 &charsets[source_charset].name, &charsets[charset].name); 328 &charsets[source_charset].name, &charsets[charset].name);
314 329
315 return ngx_http_next_header_filter(r); 330 return ngx_http_next_header_filter(r);