nginx-0.3.50-RELEASE import
*) 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.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index cd1917f..834a4c8 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 25f9232..7600ed8 100644
--- a/src/core/ngx_inet.h
+++ b/src/core/ngx_inet.h
@@ -99,7 +99,6 @@
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 6a81984..3716df6 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -750,16 +750,82 @@
}
+/*
+ * 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 @@
/* invalid utf */
- return utf->len;
+ return n;
}
return len;
diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h
index 818a290..10f87ae 100644
--- a/src/core/ngx_string.h
+++ b/src/core/ngx_string.h
@@ -146,7 +146,8 @@
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);