Mercurial > hg > nginx-vendor-0-5
diff src/http/modules/ngx_http_charset_filter_module.c @ 318:3021f899881a NGINX_0_5_29
nginx 0.5.29
*) Feature: $nginx_version variable.
Thanks to Nick S. Grechukh.
*) Bugfix: if the FastCGI header was split in records, then nginx
passed garbage in the header to a client.
*) Bugfix: Sun Studio compatibility on Solaris/amd64 and
Solaris/sparc64.
Thanks to Jiang Hong and Andrei Nigmatulin.
*) Bugfix: of minor potential bugs.
Thanks to Coverity's Scan.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 23 Jul 2007 00:00:00 +0400 |
parents | 5bef04fc3fd5 |
children | 26ff8d6b618d |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_charset_filter_module.c +++ b/src/http/modules/ngx_http_charset_filter_module.c @@ -187,7 +187,7 @@ ngx_http_charset_header_filter(ngx_http_ { u_char *ct; ngx_int_t charset, source_charset; - ngx_str_t *mc, *from, *to; + ngx_str_t *mc, *from, *to, s; ngx_uint_t n; ngx_http_charset_t *charsets; ngx_http_charset_ctx_t *ctx; @@ -256,8 +256,10 @@ ngx_http_charset_header_filter(ngx_http_ return NGX_ERROR; } - charset = ngx_http_charset_get_charset(charsets, n, - (ngx_str_t *) vv); + s.len = vv->len; + s.data = vv->data; + + charset = ngx_http_charset_get_charset(charsets, n, &s); } } @@ -303,8 +305,10 @@ ngx_http_charset_header_filter(ngx_http_ return NGX_ERROR; } - source_charset = ngx_http_charset_get_charset(charsets, n, - (ngx_str_t *) vv); + s.len = vv->len; + s.data = vv->data; + + source_charset = ngx_http_charset_get_charset(charsets, n, &s); } if (charset != NGX_HTTP_NO_CHARSET) { @@ -373,17 +377,16 @@ static ngx_int_t ngx_http_charset_get_charset(ngx_http_charset_t *charsets, ngx_uint_t n, ngx_str_t *charset) { - size_t len; ngx_uint_t i; - len = charset->len & 0xffff; - for (i = 0; i < n; i++) { - if (charsets[i].name.len != len) { + if (charsets[i].name.len != charset->len) { continue; } - if (ngx_strncasecmp(charsets[i].name.data, charset->data, len) == 0) { + if (ngx_strncasecmp(charsets[i].name.data, charset->data, charset->len) + == 0) + { return i; } }