Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_charset_filter.c @ 343:6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 28 May 2004 15:49:23 +0000 |
parents | 0bf903191ceb |
children | 55e496a8ece3 |
comparison
equal
deleted
inserted
replaced
342:0ee0642af5f1 | 343:6bdf858bff8c |
---|---|
38 ngx_int_t server; | 38 ngx_int_t server; |
39 ngx_int_t client; | 39 ngx_int_t client; |
40 } ngx_http_charset_ctx_t; | 40 } ngx_http_charset_ctx_t; |
41 | 41 |
42 | 42 |
43 static void ngx_charset_recode(ngx_hunk_t *h, char *table); | 43 static void ngx_charset_recode(ngx_buf_t *b, char *table); |
44 | 44 |
45 static char *ngx_charset_map_block(ngx_conf_t *cf, ngx_command_t *cmd, | 45 static char *ngx_charset_map_block(ngx_conf_t *cf, ngx_command_t *cmd, |
46 void *conf); | 46 void *conf); |
47 static char *ngx_charset_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); | 47 static char *ngx_charset_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); |
48 | 48 |
49 static char *ngx_http_set_charset_slot(ngx_conf_t *cf, ngx_command_t *cmd, | 49 static char *ngx_http_set_charset_slot(ngx_conf_t *cf, ngx_command_t *cmd, |
50 void *conf); | 50 void *conf); |
51 static ngx_int_t ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name); | 51 static ngx_int_t ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name); |
52 | 52 |
53 static int ngx_http_charset_filter_init(ngx_cycle_t *cycle); | 53 static ngx_int_t ngx_http_charset_filter_init(ngx_cycle_t *cycle); |
54 | 54 |
55 static void *ngx_http_charset_create_main_conf(ngx_conf_t *cf); | 55 static void *ngx_http_charset_create_main_conf(ngx_conf_t *cf); |
56 static char *ngx_http_charset_init_main_conf(ngx_conf_t *cf, void *conf); | 56 static char *ngx_http_charset_init_main_conf(ngx_conf_t *cf, void *conf); |
57 static void *ngx_http_charset_create_loc_conf(ngx_conf_t *cf); | 57 static void *ngx_http_charset_create_loc_conf(ngx_conf_t *cf); |
58 static char *ngx_http_charset_merge_loc_conf(ngx_conf_t *cf, | 58 static char *ngx_http_charset_merge_loc_conf(ngx_conf_t *cf, |
210 | 210 |
211 charsets = mcf->charsets.elts; | 211 charsets = mcf->charsets.elts; |
212 table = charsets[lcf->source_charset].tables[lcf->default_charset]; | 212 table = charsets[lcf->source_charset].tables[lcf->default_charset]; |
213 | 213 |
214 for (cl = in; cl; cl = cl->next) { | 214 for (cl = in; cl; cl = cl->next) { |
215 ngx_charset_recode(cl->hunk, table); | 215 ngx_charset_recode(cl->buf, table); |
216 } | 216 } |
217 | 217 |
218 return ngx_http_next_body_filter(r, in); | 218 return ngx_http_next_body_filter(r, in); |
219 } | 219 } |
220 | 220 |
221 | 221 |
222 static void ngx_charset_recode(ngx_hunk_t *h, char *table) | 222 static void ngx_charset_recode(ngx_buf_t *b, char *table) |
223 { | 223 { |
224 u_char *p, c; | 224 u_char *p, c; |
225 | 225 |
226 for (p = h->pos; p < h->last; p++) { | 226 for (p = b->pos; p < b->last; p++) { |
227 c = *p; | 227 c = *p; |
228 *p = table[c]; | 228 *p = table[c]; |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
410 | 410 |
411 return i; | 411 return i; |
412 } | 412 } |
413 | 413 |
414 | 414 |
415 static int ngx_http_charset_filter_init(ngx_cycle_t *cycle) | 415 static ngx_int_t ngx_http_charset_filter_init(ngx_cycle_t *cycle) |
416 { | 416 { |
417 ngx_http_next_header_filter = ngx_http_top_header_filter; | 417 ngx_http_next_header_filter = ngx_http_top_header_filter; |
418 ngx_http_top_header_filter = ngx_http_charset_header_filter; | 418 ngx_http_top_header_filter = ngx_http_charset_header_filter; |
419 | 419 |
420 ngx_http_next_body_filter = ngx_http_top_body_filter; | 420 ngx_http_next_body_filter = ngx_http_top_body_filter; |