Mercurial > hg > nginx-vendor-0-6
diff src/http/modules/ngx_http_charset_filter.c @ 4:4b2dafa26fe2 NGINX_0_1_2
nginx 0.1.2
*) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS
options in configure.
*) Feature: the server_name directive supports *.domain.tld.
*) Bugfix: the portability improvements.
*) Bugfix: if configuration file was set in command line, the
reconfiguration was impossible; bug appeared in 0.1.1.
*) Bugfix: proxy module may get caught in an endless loop when sendfile
is not used.
*) Bugfix: with sendfile the response was not recoded according to the
charset module directives; bug appeared in 0.1.1.
*) Bugfix: very seldom bug in the kqueue processing.
*) Bugfix: the gzip module compressed the proxied responses that was
already compressed.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 21 Oct 2004 00:00:00 +0400 |
parents | f0b350454894 |
children | 46833bd150cb |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_charset_filter.c +++ b/src/http/modules/ngx_http_charset_filter.c @@ -12,7 +12,7 @@ typedef struct { char **tables; ngx_str_t name; - unsigned server; + ngx_uint_t server; /* unsigned server:1; */ } ngx_http_charset_t; @@ -45,7 +45,7 @@ typedef struct { } ngx_http_charset_ctx_t; -static void ngx_charset_recode(ngx_buf_t *b, char *table); +static ngx_uint_t ngx_charset_recode(ngx_buf_t *b, char *table); static char *ngx_charset_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -232,14 +232,31 @@ static ngx_int_t ngx_http_charset_body_f } -static void ngx_charset_recode(ngx_buf_t *b, char *table) +static ngx_uint_t ngx_charset_recode(ngx_buf_t *b, char *table) { - u_char *p, c; + u_char *p; + ngx_uint_t change; + + change = 0; for (p = b->pos; p < b->last; p++) { - c = *p; - *p = table[c]; + if (*p != table[*p]) { + change = 1; + break; + } } + + if (change) { + + while (p < b->last) { + *p = table[*p]; + p++; + } + + b->in_file = 0; + } + + return change; } @@ -419,7 +436,9 @@ static ngx_int_t ngx_http_add_charset(ng return NGX_ERROR; } + c->tables = NULL; c->name = *name; + c->server = 0; return i; }