diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-06-28 16:00:26 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-06-28 16:00:26 +0000 |
commit | ef809b86c36a9584a15df6caac2eb727ceacc10d (patch) | |
tree | 80dc756ea197b259b159fb9a47b09df1a1eae7f1 /src/core | |
parent | f115ebe9c3d57c0b271b03ed931ff42cdef37eb2 (diff) | |
download | nginx-release-0.3.50.tar.gz nginx-release-0.3.50.zip |
nginx-0.3.50-RELEASE importrelease-0.3.50
*) Change: the "proxy_redirect_errors" and "fastcgi_redirect_errors"
directives was renamed to the "proxy_intercept_errors" and
"fastcgi_intercept_errors" directives.
*) Feature: the ngx_http_charset_module supports the recoding from the
single byte encodings to the UTF-8 encoding and back.
*) Feature: the "X-Accel-Charset" response header line is supported in
proxy and FastCGI mode.
*) Bugfix: the "\" escape symbol in the "\"" and "\'" pairs in the SSI
command was removed only if the command also has the "$" symbol.
*) Bugfix: the "<!--" string might be added on some conditions in the
SSI after inclusion.
*) Bugfix: if the "Content-Length: 0" header line was in response, then
in nonbuffered proxying mode the client connection was not closed.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nginx.h | 2 | ||||
-rw-r--r-- | src/core/ngx_inet.h | 1 | ||||
-rw-r--r-- | src/core/ngx_string.c | 74 | ||||
-rw-r--r-- | src/core/ngx_string.h | 3 |
4 files changed, 73 insertions, 7 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h index cd1917fec..834a4c895 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.3.49" +#define NGINX_VER "nginx/0.3.50" #define NGINX_VAR "NGINX" #define NGX_OLDPID_EXT ".oldbin" diff --git a/src/core/ngx_inet.h b/src/core/ngx_inet.h index 25f923230..7600ed801 100644 --- a/src/core/ngx_inet.h +++ b/src/core/ngx_inet.h @@ -99,7 +99,6 @@ typedef struct { unsigned uri_part:1; unsigned port_only:1; - unsigned virtual:1; } ngx_inet_upstream_t; diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index 6a81984dd..3716df661 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -750,16 +750,82 @@ ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src) } +/* + * ngx_utf_decode() decodes two and more bytes UTF sequences only + * the return values: + * 0x80 - 0x10ffff valid character + * 0x10ffff - 0xfffffffd invalid sequence + * 0xfffffffe incomplete sequence + * 0xffffffff error + */ + +uint32_t +ngx_utf_decode(u_char **p, size_t n) +{ + size_t len; + uint32_t u, i, valid; + + u = **p; + + if (u > 0xf0) { + + u &= 0x07; + valid = 0xffff; + len = 3; + + } else if (u > 0xe0) { + + u &= 0x0f; + valid = 0x7ff; + len = 2; + + } else if (u > 0xc0) { + + u &= 0x1f; + valid = 0x7f; + len = 1; + + } else { + (*p)++; + return 0xffffffff; + } + + if (n - 1 < len) { + return 0xfffffffe; + } + + (*p)++; + + while (len) { + i = *(*p)++; + + if (i < 0x80) { + return 0xffffffff; + } + + u = (u << 6) | (i & 0x3f); + + len--; + } + + if (u > valid) { + return u; + } + + return 0xffffffff; +} + + size_t -ngx_utf_length(ngx_str_t *utf) +ngx_utf_length(u_char *p, size_t n) { u_char c; size_t len; ngx_uint_t i; - for (len = 0, i = 0; i < utf->len; len++, i++) { + for (len = 0, i = 0; i < n; len++, i++) { - c = utf->data[i]; + c = p[i]; if (c < 0x80) { continue; @@ -775,7 +841,7 @@ ngx_utf_length(ngx_str_t *utf) /* invalid utf */ - return utf->len; + return n; } return len; diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index 818a290d1..10f87ae93 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -146,7 +146,8 @@ void ngx_md5_text(u_char *text, u_char *md5); void ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src); ngx_int_t ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src); -size_t ngx_utf_length(ngx_str_t *utf); +uint32_t ngx_utf_decode(u_char **p, size_t n); +size_t ngx_utf_length(u_char *p, size_t n); u_char * ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n); |