comparison src/http/modules/ngx_http_charset_filter.c @ 340:0bf903191ceb

nginx-0.0.3-2004-05-25-19:28:46 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 25 May 2004 15:28:46 +0000
parents 8c5b69141dfd
children 6bdf858bff8c
comparison
equal deleted inserted replaced
339:8c5b69141dfd 340:0bf903191ceb
289 if (!(table->dst2src = ngx_palloc(cf->pool, 256))) { 289 if (!(table->dst2src = ngx_palloc(cf->pool, 256))) {
290 return NGX_CONF_ERROR; 290 return NGX_CONF_ERROR;
291 } 291 }
292 292
293 for (i = 0; i < 128; i++) { 293 for (i = 0; i < 128; i++) {
294 table->src2dst[i] = i; 294 table->src2dst[i] = (char) i;
295 table->dst2src[i] = i; 295 table->dst2src[i] = (char) i;
296 } 296 }
297 297
298 for (/* void */; i < 256; i++) { 298 for (/* void */; i < 256; i++) {
299 table->src2dst[i] = '?'; 299 table->src2dst[i] = '?';
300 table->dst2src[i] = '?'; 300 table->dst2src[i] = '?';
311 } 311 }
312 312
313 313
314 static char *ngx_charset_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) 314 static char *ngx_charset_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
315 { 315 {
316 ngx_http_charset_main_conf_t *mcf = conf;
317
318 ngx_int_t src, dst; 316 ngx_int_t src, dst;
319 ngx_str_t *value; 317 ngx_str_t *value;
320 ngx_http_charset_tables_t *table; 318 ngx_http_charset_tables_t *table;
321 319
322 if (cf->args->nelts != 2) { 320 if (cf->args->nelts != 2) {
340 return NGX_CONF_ERROR; 338 return NGX_CONF_ERROR;
341 } 339 }
342 340
343 table = cf->ctx; 341 table = cf->ctx;
344 342
345 table->src2dst[src] = dst; 343 table->src2dst[src] = (char) dst;
346 table->dst2src[dst] = src; 344 table->dst2src[dst] = (char) src;
347 345
348 return NGX_CONF_OK; 346 return NGX_CONF_OK;
349 } 347 }
350 348
351 349
447 static char *ngx_http_charset_init_main_conf(ngx_conf_t *cf, void *conf) 445 static char *ngx_http_charset_init_main_conf(ngx_conf_t *cf, void *conf)
448 { 446 {
449 ngx_http_charset_main_conf_t *mcf = conf; 447 ngx_http_charset_main_conf_t *mcf = conf;
450 448
451 ngx_uint_t i, n; 449 ngx_uint_t i, n;
452 ngx_http_charset_t *charset, *c; 450 ngx_http_charset_t *charset;
453 ngx_http_charset_tables_t *tables; 451 ngx_http_charset_tables_t *tables;
454 452
455 tables = mcf->tables.elts; 453 tables = mcf->tables.elts;
456 charset = mcf->charsets.elts; 454 charset = mcf->charsets.elts;
457 455
529 ngx_http_charset_loc_conf_t *conf = child; 527 ngx_http_charset_loc_conf_t *conf = child;
530 528
531 ngx_conf_merge_value(conf->enable, prev->enable, 0); 529 ngx_conf_merge_value(conf->enable, prev->enable, 0);
532 ngx_conf_merge_value(conf->autodetect, prev->autodetect, 0); 530 ngx_conf_merge_value(conf->autodetect, prev->autodetect, 0);
533 531
534 if (conf->default_charset == NGX_CONF_UNSET) {
535 conf->default_charset = prev->default_charset;
536 }
537
538 if (conf->source_charset == NGX_CONF_UNSET) { 532 if (conf->source_charset == NGX_CONF_UNSET) {
539 conf->source_charset = prev->source_charset; 533 conf->source_charset = prev->source_charset;
540 } 534 }
541 535
536 ngx_conf_merge_value(conf->default_charset, prev->default_charset,
537 conf->source_charset);
538
542 return NGX_CONF_OK; 539 return NGX_CONF_OK;
543 } 540 }