nginx-0.1.35-RELEASE import

    *) Feature: the "working_directory" directive.

    *) Feature: the "port_in_redirect" directive.

    *) Bugfix: the segmentation fault was occurred if the backend response
       header was in several packets; the bug had appeared in 0.1.29.

    *) Bugfix: if more than 10 servers were configured or some server did
       not use the "listen" directive, then the segmentation fault was
       occurred on the start.

    *) Bugfix: the segmentation fault might occur if the response was
       bigger than the temporary file.

    *) Bugfix: nginx returned the 400 response on requests like
       "GET http://www.domain.com/uri HTTP/1.0"; the bug had appeared in
       0.1.28.
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 7b98e12..4a01acd 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -95,6 +95,13 @@
       offsetof(ngx_core_conf_t, pid),
       NULL },
 
+    { ngx_string("working_directory"),
+      NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_str_slot,
+      0,
+      offsetof(ngx_core_conf_t, working_directory),
+      NULL },
+
       ngx_null_command
 };
 
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 1a08c42..94b6da3 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.1.34"
+#define NGINX_VER          "nginx/0.1.35"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 4268157..ff9c164 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -12,9 +12,8 @@
 ngx_os_io_t  ngx_io;
 
 
-ngx_listening_t *ngx_listening_inet_stream_socket(ngx_conf_t *cf,
-                                                  in_addr_t addr,
-                                                  in_port_t port)
+ngx_listening_t *
+ngx_listening_inet_stream_socket(ngx_conf_t *cf, in_addr_t addr, in_port_t port)
 {
     size_t               len;
     ngx_listening_t     *ls;
@@ -60,7 +59,8 @@
 }
 
 
-ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle)
+ngx_int_t
+ngx_set_inherited_sockets(ngx_cycle_t *cycle)
 {
     size_t               len;
     ngx_uint_t           i;
@@ -121,7 +121,8 @@
 }
 
 
-ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle)
+ngx_int_t
+ngx_open_listening_sockets(ngx_cycle_t *cycle)
 {
     ngx_uint_t        tries, failed, reuseaddr, i;
     ngx_err_t         err;
@@ -261,7 +262,8 @@
 }
 
 
-void ngx_close_listening_sockets(ngx_cycle_t *cycle)
+void
+ngx_close_listening_sockets(ngx_cycle_t *cycle)
 {
     ngx_uint_t        i;
     ngx_socket_t      fd;
@@ -309,7 +311,8 @@
 }
 
 
-void ngx_close_connection(ngx_connection_t *c)
+void
+ngx_close_connection(ngx_connection_t *c)
 {
     ngx_socket_t  fd;
 
@@ -398,7 +401,8 @@
 }
 
 
-ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
+ngx_int_t
+ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
 {
     ngx_uint_t  level;
 
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index bbca32b..8fb6705 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -144,8 +144,7 @@
 
 
 ngx_listening_t *ngx_listening_inet_stream_socket(ngx_conf_t *cf,
-                                                 in_addr_t addr,
-                                                 in_port_t port);
+    in_addr_t addr, in_port_t port);
 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
 ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
 void ngx_close_listening_sockets(ngx_cycle_t *cycle);
diff --git a/src/core/ngx_cycle.h b/src/core/ngx_cycle.h
index b1b5348..6ed753a 100644
--- a/src/core/ngx_cycle.h
+++ b/src/core/ngx_cycle.h
@@ -57,6 +57,8 @@
      ngx_uid_t                user;
      ngx_gid_t                group;
 
+     ngx_str_t                working_directory;
+
      ngx_str_t                pid;
      ngx_str_t                newpid;
 
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index 0307bb1..acc4bd3 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -792,8 +792,30 @@
           0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
           0xffffffff  /* 1111 1111 1111 1111  1111 1111 1111 1111 */ };
 
+                      /* " ", """, "%", "'", %00-%1F, %7F-%FF */
+
+    static uint32_t   utf[] =
+        { 0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
+
+                      /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
+          0x800000ad, /* 0000 0000 0000 0000  0000 0000 1010 1101 */
+
+                      /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
+          0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+
+                      /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
+          0x80000000, /* 1000 0000 0000 0000  0000 0000 0000 0000 */
+
+          0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+          0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+          0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+          0x00000000  /* 0000 0000 0000 0000  0000 0000 0000 0000 */ };
+
 
     switch (type) {
+    case NGX_ESCAPE_UTF:
+        escape = utf;
+        break;
     case NGX_ESCAPE_HTML:
         escape = html;
         break;
diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h
index c72a776..e2e20e1 100644
--- a/src/core/ngx_string.h
+++ b/src/core/ngx_string.h
@@ -100,6 +100,7 @@
 #define NGX_ESCAPE_URI   0
 #define NGX_ESCAPE_ARGS  1
 #define NGX_ESCAPE_HTML  2
+#define NGX_ESCAPE_UTF   3
 
 uintptr_t ngx_escape_uri(u_char *dst, u_char *src, size_t size,
     ngx_uint_t type);