nginx-0.1.29-RELEASE import

    *) Feature: the ngx_http_ssi_module supports "include virtual" command.

    *) Feature: the ngx_http_ssi_module supports the condition command like
       'if expr="$NAME"' and "else" and "endif" commands. Only one nested
       level is supported.

    *) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and
       DATE_GMT variables and "config timefmt" command.

    *) Feature: the "ssi_ignore_recycled_buffers" directive.

    *) Bugfix: the "echo" command did not show the default value for the
       empty QUERY_STRING variable.

    *) Change: the ngx_http_proxy_module was rewritten.

    *) Feature: the "proxy_redirect", "proxy_pass_request_headers",
       "proxy_pass_request_body", and "proxy_method" directives.

    *) Feature: the "proxy_set_header" directive. The "proxy_x_var" was
       canceled and must be replaced with the proxy_set_header directive.

    *) Change: the "proxy_preserve_host" is canceled and must be replaced
       with the "proxy_set_header Host $host" and the "proxy_redirect off"
       directives, the "proxy_set_header Host $host:$proxy_port" directive
       and the appropriate proxy_redirect directives.

    *) Change: the "proxy_set_x_real_ip" is canceled and must be replaced
       with the "proxy_set_header X-Real-IP $remote_addr" directive.

    *) Change: the "proxy_add_x_forwarded_for" is canceled and must be
       replaced with
       the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
       directive.

    *) Change: the "proxy_set_x_url" is canceled and must be replaced with
       the "proxy_set_header X-URL http://$host:$server_port$request_uri"
       directive.

    *) Feature: the "fastcgi_param" directive.

    *) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params"
       directive are canceled and must be replaced with the fastcgi_param
       directives.

    *) Feature: the "index" directive can use the variables.

    *) Feature: the "index" directive can be used at http and server levels.

    *) Change: the last index only in the "index" directive can be absolute.

    *) Feature: the "rewrite" directive can use the variables.

    *) Feature: the "internal" directive.

    *) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR,
       SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME,
       REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables.

    *) Change: nginx now passes the invalid lines in a client request
       headers or a backend response header.

    *) Bugfix: if the backend did not transfer response for a long time and
       the "send_timeout" was less than "proxy_read_timeout", then nginx
       returned the 408 response.

    *) Bugfix: the segmentation fault was occurred if the backend sent an
       invalid line in response header; the bug had appeared in 0.1.26.

    *) Bugfix: the segmentation fault may occurred in FastCGI fault
       tolerance configuration.

    *) Bugfix: the "expires" directive did not remove the previous
       "Expires" and "Cache-Control" headers.

    *) Bugfix: nginx did not take into account trailing dot in "Host"
       header line.

    *) Bugfix: the ngx_http_auth_module did not work under Linux.

    *) Bugfix: the rewrite directive worked incorrectly, if the arguments
       were in a request.

    *) Bugfix: nginx could not be built on MacOS X.
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 9f22112..bb6f093 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -107,7 +107,7 @@
 
 
 ngx_module_t  ngx_core_module = {
-    NGX_MODULE,
+    NGX_MODULE_V1,
     &ngx_core_module_ctx,                  /* module context */
     ngx_core_commands,                     /* module directives */
     NGX_CORE_MODULE,                       /* module type */
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 9fa141a..4d27a87 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.28"
+#define NGINX_VER          "nginx/0.1.29"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
diff --git a/src/core/ngx_array.h b/src/core/ngx_array.h
index 5f97451..00206cb 100644
--- a/src/core/ngx_array.h
+++ b/src/core/ngx_array.h
@@ -30,16 +30,21 @@
 static ngx_inline ngx_int_t
 ngx_array_init(ngx_array_t *array, ngx_pool_t *pool, ngx_uint_t n, size_t size)
 {
-    array->elts = ngx_palloc(pool, n * size);
-    if (array->elts == NULL) {
-        return NGX_ERROR;
-    }
+    /*
+     * set "array->nelts" before "array->elts", otherwise MSVC thinks
+     * that "array->nelts" may be used without having been initialized
+     */
 
     array->nelts = 0;
     array->size = size;
     array->nalloc = n;
     array->pool = pool;
 
+    array->elts = ngx_palloc(pool, n * size);
+    if (array->elts == NULL) {
+        return NGX_ERROR;
+    }
+
     return NGX_OK;
 }
 
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
index 4c1b1d5..b7f597d 100644
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -31,7 +31,7 @@
      *     b->file = NULL;
      *     b->shadow = NULL;
      *     b->tag = 0;
-     *
+     *     and flags
      */
 
     b->pos = b->start;
@@ -94,6 +94,7 @@
          *     b->file = NULL;
          *     b->shadow = NULL;
          *     b->tag = 0;
+         *     and flags
          *
          */
 
diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h
index 96394f9..471ab19 100644
--- a/src/core/ngx_buf.h
+++ b/src/core/ngx_buf.h
@@ -44,7 +44,9 @@
     unsigned         recycled:1;
     unsigned         in_file:1;
     unsigned         flush:1;
+    unsigned         sync:1;
     unsigned         last_buf:1;
+    unsigned         last_in_chain:1;
 
     unsigned         last_shadow:1;
     unsigned         temp_file:1;
@@ -104,7 +106,8 @@
 #define ngx_buf_in_memory(b)        (b->temporary || b->memory || b->mmap)
 #define ngx_buf_in_memory_only(b)   (ngx_buf_in_memory(b) && !b->in_file)
 #define ngx_buf_special(b)                                                   \
-    ((b->flush || b->last_buf) && !ngx_buf_in_memory(b) && !b->in_file)
+    ((b->flush || b->last_buf || b->sync)                                    \
+     && !ngx_buf_in_memory(b) && !b->in_file)
 
 #define ngx_buf_size(b)                                                      \
     (ngx_buf_in_memory(b) ? (off_t) (b->last - b->pos):                      \
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 35ee8b8..b9b2200 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -27,7 +27,7 @@
 
 
 ngx_module_t  ngx_conf_module = {
-    NGX_MODULE,
+    NGX_MODULE_V1,
     NULL,                                  /* module context */
     ngx_conf_commands,                     /* module directives */
     NGX_CONF_MODULE,                       /* module type */
@@ -336,7 +336,7 @@
 {
     u_char      *start, ch, *src, *dst;
     int          len;
-    int          found, need_space, last_space, sharp_comment;
+    int          found, need_space, last_space, sharp_comment, variable;
     int          quoted, s_quoted, d_quoted;
     ssize_t      n;
     ngx_str_t   *word;
@@ -346,6 +346,7 @@
     need_space = 0;
     last_space = 1;
     sharp_comment = 0;
+    variable = 0;
     quoted = s_quoted = d_quoted = 0;
 
     cf->args->nelts = 0;
@@ -492,11 +493,22 @@
             }
 
         } else {
+            if (ch == '{' && variable) {
+                continue;
+            }
+
+            variable = 0;
+
             if (ch == '\\') {
                 quoted = 1;
                 continue;
             }
 
+            if (ch == '$') {
+                variable = 1;
+                continue;
+            }
+
             if (d_quoted) {
                 if (ch == '"') {
                     d_quoted = 0;
@@ -802,6 +814,45 @@
 
 
 char *
+ngx_conf_set_table_elt_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+    char  *p = conf;
+
+    ngx_str_t         *value;
+    ngx_array_t      **a;
+    ngx_table_elt_t   *elt;
+    ngx_conf_post_t   *post;
+
+    a = (ngx_array_t **) (p + cmd->offset);
+
+    if (*a == NULL) {
+        *a = ngx_array_create(cf->pool, 4, sizeof(ngx_table_elt_t));
+        if (*a == NULL) {
+            return NGX_CONF_ERROR;
+        }
+    }
+
+    elt = ngx_array_push(*a);
+    if (elt == NULL) {
+        return NGX_CONF_ERROR;
+    }
+
+    value = cf->args->elts;
+
+    elt->hash = 0;
+    elt->key = value[1];
+    elt->value = value[2];
+
+    if (cmd->post) {
+        post = cmd->post;
+        return post->post_handler(cf, post, elt);
+    }
+
+    return NGX_CONF_OK;
+}
+
+
+char *
 ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 {
     char  *p = conf;
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 4fab8c1..899f046 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -63,7 +63,7 @@
 #define NGX_CONF_BLOCK_DONE  2
 #define NGX_CONF_FILE_DONE   3
 
-#define NGX_MODULE           0, 0
+#define NGX_MODULE_V1        0, 0, 1, 0, 0
 
 #define NGX_CORE_MODULE      0x45524F43  /* "CORE" */
 #define NGX_CONF_MODULE      0x464E4F43  /* "CONF" */
@@ -100,6 +100,10 @@
 struct ngx_module_s {
     ngx_uint_t            ctx_index;
     ngx_uint_t            index;
+    ngx_uint_t            version;
+    ngx_uint_t            spare0;
+    ngx_uint_t            spare1;
+
     void                 *ctx;
     ngx_command_t        *commands;
     ngx_uint_t            type;
@@ -280,6 +284,8 @@
 
 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
+char *ngx_conf_set_table_elt_slot(ngx_conf_t *cf, ngx_command_t *cmd,
+    void *conf);
 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 5104205..eaebdb0 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -517,7 +517,7 @@
         ngx_old_cycles.nalloc = n;
         ngx_old_cycles.pool = ngx_temp_pool;
 
-        ngx_cleaner_event.event_handler = ngx_clean_old_cycles;
+        ngx_cleaner_event.handler = ngx_clean_old_cycles;
         ngx_cleaner_event.log = cycle->log;
         ngx_cleaner_event.data = &dumb;
         dumb.fd = (ngx_socket_t) -1;
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 6fe04e7..46d2e0a 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -38,8 +38,10 @@
 ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
     int persistent)
 {
-    ngx_err_t           err;
-    ngx_atomic_uint_t   n;
+    ngx_err_t                 err;
+    ngx_atomic_uint_t         n;
+    ngx_pool_cleanup_file_t  *cln;
+
 
     file->name.len = path->name.len + 1 + path->len + NGX_ATOMIC_T_LEN;
 
@@ -74,6 +76,20 @@
                        "temp fd:%d", file->fd);
 
         if (file->fd != NGX_INVALID_FILE) {
+            cln = ngx_palloc(pool, sizeof(ngx_pool_cleanup_file_t));
+            if (cln == NULL) {
+                return NGX_ERROR; 
+            }
+
+            cln->fd = file->fd;
+            cln->name = file->name.data;
+            cln->log = pool->log;
+
+            if (ngx_pool_cleanup_add(pool, ngx_pool_cleanup_file, cln) == NULL)
+            {
+                return NGX_ERROR;
+            }
+
             return NGX_OK;
         }
 
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index 2c062b7..6b75fa5 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -9,11 +9,20 @@
 
 
 ngx_int_t
-ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names)
+ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names, ngx_uint_t nelts)
 {
     u_char      *p;
-    ngx_str_t   *n, *bucket;
-    ngx_uint_t   i, key, size, best, *test, buckets, min_buckets;
+    ngx_str_t   *name, *bucket;
+    ngx_uint_t   i, n, key, size, best, *test, buckets, min_buckets;
+
+    if (nelts == 0) {
+        for (name = (ngx_str_t *) names;
+             name->len;
+             name = (ngx_str_t *) ((char *) name + hash->bucket_size))
+        {
+            nelts++;
+        }
+    }
 
     test = ngx_alloc(hash->max_size * sizeof(ngx_uint_t), pool->log);
     if (test == NULL) {
@@ -34,14 +43,14 @@
             test[i] = 0;
         }
 
-        for (n = (ngx_str_t *) names;
-             n->len;
-             n = (ngx_str_t *) ((char *) n + hash->bucket_size))
+        for (n = 0, name = (ngx_str_t *) names;
+             n < nelts;
+             n++, name = (ngx_str_t *) ((char *) name + hash->bucket_size))
         {
             key = 0;
 
-            for (i = 0; i < n->len; i++) {
-                key += ngx_tolower(n->data[i]);
+            for (i = 0; i < name->len; i++) {
+                key += ngx_tolower(name->data[i]);
             }
 
             key %= size;
@@ -57,7 +66,7 @@
             }
         }
 
-        if (n->len == 0) {
+        if (n == nelts) {
             if (min_buckets > buckets) {
                 min_buckets = buckets;
                 best = size;
@@ -91,14 +100,14 @@
             test[i] = 0;
         }
 
-        for (n = (ngx_str_t *) names;
-             n->len;
-             n = (ngx_str_t *) ((char *) n + hash->bucket_size))
+        for (n = 0, name = (ngx_str_t *) names;
+             n < nelts;
+             n++, name = (ngx_str_t *) ((char *) name + hash->bucket_size))
         {
             key = 0;
 
-            for (i = 0; i < n->len; i++) {
-                key += ngx_tolower(n->data[i]);
+            for (i = 0; i < name->len; i++) {
+                key += ngx_tolower(name->data[i]);
             }
 
             key %= best;
@@ -122,21 +131,21 @@
         }
     }
 
-    for (n = (ngx_str_t *) names;
-         n->len;
-         n = (ngx_str_t *) ((char *) n + hash->bucket_size))
+    for (n = 0, name = (ngx_str_t *) names;
+         n < nelts;
+         n++, name = (ngx_str_t *) ((char *) name + hash->bucket_size))
     {
         key = 0;
 
-        for (i = 0; i < n->len; i++) {
-            key += ngx_tolower(n->data[i]);
+        for (i = 0; i < name->len; i++) {
+            key += ngx_tolower(name->data[i]);
         }
 
         key %= best;
 
         if (hash->bucket_limit == 1) {
             p = (u_char *) hash->buckets + key * hash->bucket_size;
-            ngx_memcpy(p, n, hash->bucket_size);
+            ngx_memcpy(p, name, hash->bucket_size);
             continue;
         }
 
@@ -147,7 +156,7 @@
             bucket->len &= 0x7fffffff;
         }
 
-        ngx_memcpy(bucket, n, hash->bucket_size);
+        ngx_memcpy(bucket, name, hash->bucket_size);
         bucket->len |= 0x80000000;
     }
 
diff --git a/src/core/ngx_hash.h b/src/core/ngx_hash.h
index 5a4bf5f..e991257 100644
--- a/src/core/ngx_hash.h
+++ b/src/core/ngx_hash.h
@@ -31,7 +31,8 @@
 } ngx_table_elt_t;
 
 
-ngx_int_t ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names);
+ngx_int_t ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names,
+    ngx_uint_t nelts);
 
 
 #endif /* _NGX_HASH_H_INCLUDED_ */
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 6cad053..1ae7829 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -21,7 +21,8 @@
  */
 
 
-static ngx_inline size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len)
+static
+ngx_inline size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len)
 {
     size_t      n;
     ngx_uint_t  c1, c2;
@@ -65,8 +66,8 @@
 
 /* AF_INET only */
 
-size_t ngx_sock_ntop(int family, struct sockaddr *sa, u_char *text,
-                     size_t len)
+size_t
+ngx_sock_ntop(int family, struct sockaddr *sa, u_char *text, size_t len)
 {
     u_char              *p;
     size_t               n;
@@ -119,7 +120,8 @@
     return n;
 }
 
-size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len)
+size_t
+ngx_inet_ntop(int family, void *addr, u_char *text, size_t len)
 {
     u_char      *p;
     size_t       n;
@@ -173,7 +175,8 @@
 
 /* AF_INET only */
 
-ngx_int_t ngx_ptocidr(ngx_str_t *text, void *cidr)
+ngx_int_t
+ngx_ptocidr(ngx_str_t *text, void *cidr)
 {
     ngx_int_t         m;
     ngx_uint_t        i;
@@ -217,7 +220,8 @@
 }
 
 
-ngx_peers_t *ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u)
+ngx_peers_t *
+ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u)
 {
     char                *err;
     u_char              *host;
@@ -392,7 +396,8 @@
 }
 
 
-char *ngx_inet_parse_host_port(ngx_inet_upstream_t *u)
+char *
+ngx_inet_parse_host_port(ngx_inet_upstream_t *u)
 {
     size_t      i;
     ngx_int_t   port;
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 181d059..2782582 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -33,7 +33,7 @@
 
 
 ngx_module_t  ngx_errlog_module = {
-    NGX_MODULE,
+    NGX_MODULE_V1,
     &ngx_errlog_module_ctx,                /* module context */
     ngx_errlog_commands,                   /* module directives */
     NGX_CORE_MODULE,                       /* module type */
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index fc8a0bf..e4a8723 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -49,7 +49,7 @@
 #if (NGX_SENDFILE_LIMIT)
             && !(in->buf->in_file && in->buf->file_last > NGX_SENDFILE_LIMIT)
 #endif
-            && (!ngx_output_chain_need_to_copy(ctx, in->buf)))
+            && !ngx_output_chain_need_to_copy(ctx, in->buf))
         {
             return ctx->output_filter(ctx->filter_ctx, in);
         }
@@ -132,7 +132,7 @@
 
                     size = ctx->bufs.size;
 
-                    if (ctx->in->buf->last_buf) {
+                    if (ctx->in->buf->last_in_chain) {
 
                         if (bsize < (off_t) ctx->bufs.size) {
 
@@ -202,6 +202,11 @@
         }
 
         if (out == NULL && last != NGX_NONE) {
+
+            if (ctx->in) {
+                return NGX_AGAIN;
+            }
+
             return last;
         }
 
diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
index 2804dd0..e7c8882 100644
--- a/src/core/ngx_palloc.c
+++ b/src/core/ngx_palloc.c
@@ -23,6 +23,7 @@
     p->next = NULL;
     p->large = NULL;
     p->chain = NULL;
+    p->cleanup = NULL;
     p->log = log;
 
     return p;
@@ -32,8 +33,15 @@
 void
 ngx_destroy_pool(ngx_pool_t *pool)
 {
-    ngx_pool_t        *p, *n;
-    ngx_pool_large_t  *l;
+    ngx_pool_t          *p, *n;
+    ngx_pool_large_t    *l;
+    ngx_pool_cleanup_t  *c;
+
+    for (c = pool->cleanup; c; c = c->next) {
+        if (c->handler) {
+            c->handler(c->data);
+        }
+    }
 
     for (l = pool->large; l; l = l->next) {
 
@@ -197,6 +205,39 @@
     return p;
 }
 
+
+ngx_pool_cleanup_t *
+ngx_pool_cleanup_add(ngx_pool_t *p, ngx_pool_cleanup_pt handler, void *data)
+{
+    ngx_pool_cleanup_t  *c;
+
+    c = ngx_palloc(p, sizeof(ngx_pool_cleanup_t));
+    if (c == NULL) {
+        return NULL;
+    }
+
+    c->handler = handler;
+    c->data = data;
+    c->next = p->cleanup;
+
+    p->cleanup = c;
+
+    return c;
+}
+
+
+void
+ngx_pool_cleanup_file(void *data)
+{
+    ngx_pool_cleanup_file_t  *c = data;
+
+    if (ngx_close_file(c->fd) == NGX_FILE_ERROR) {
+        ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
+                      ngx_close_file_n " \"%s\" failed", c->name);
+    }
+}
+
+
 #if 0
 
 static void *
diff --git a/src/core/ngx_palloc.h b/src/core/ngx_palloc.h
index bd256e8..62a5718 100644
--- a/src/core/ngx_palloc.h
+++ b/src/core/ngx_palloc.h
@@ -22,24 +22,44 @@
 #define NGX_DEFAULT_POOL_SIZE   (16 * 1024)
 
 
+typedef void (*ngx_pool_cleanup_pt)(void *data);
+
+typedef struct ngx_pool_cleanup_s  ngx_pool_cleanup_t;
+
+struct ngx_pool_cleanup_s {
+    ngx_pool_cleanup_pt   handler;
+    void                 *data;
+    ngx_pool_cleanup_t   *next;
+};
+
+
 typedef struct ngx_pool_large_s  ngx_pool_large_t;
 
 struct ngx_pool_large_s {
-    ngx_pool_large_t  *next;
-    void              *alloc;
+    ngx_pool_large_t     *next;
+    void                 *alloc;
 };
 
 
 struct ngx_pool_s {
-    u_char            *last;
-    u_char            *end;
-    ngx_chain_t       *chain;
-    ngx_pool_t        *next;
-    ngx_pool_large_t  *large;
-    ngx_log_t         *log;
+    u_char               *last;
+    u_char               *end;
+    ngx_chain_t          *chain;
+    ngx_pool_t           *next;
+    ngx_pool_large_t     *large;
+    ngx_pool_cleanup_t   *cleanup;
+    ngx_log_t            *log;
 };
 
 
+typedef struct {
+    ngx_fd_t              fd;
+    u_char               *name;
+    ngx_log_t            *log;
+} ngx_pool_cleanup_file_t;
+
+
+
 void *ngx_alloc(size_t size, ngx_log_t *log);
 void *ngx_calloc(size_t size, ngx_log_t *log);
 
@@ -51,4 +71,9 @@
 ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p);
 
 
+ngx_pool_cleanup_t *ngx_pool_cleanup_add(ngx_pool_t *p,
+    ngx_pool_cleanup_pt handler, void *data);
+void ngx_pool_cleanup_file(void *data);
+
+
 #endif /* _NGX_PALLOC_H_INCLUDED_ */
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index e4fa69d..30938a1 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -12,8 +12,9 @@
 ngx_epoch_msec_t  ngx_old_elapsed_msec;
 ngx_epoch_msec_t  ngx_start_msec;
 
+ngx_int_t  ngx_gmtoff;
+
 static ngx_tm_t   ngx_cached_gmtime;
-static ngx_int_t  ngx_gmtoff;
 
 
 /*
diff --git a/src/core/ngx_times.h b/src/core/ngx_times.h
index f9c4d3e..2959cc4 100644
--- a/src/core/ngx_times.h
+++ b/src/core/ngx_times.h
@@ -53,6 +53,7 @@
  */
 extern ngx_epoch_msec_t  ngx_old_elapsed_msec;
 
+extern ngx_int_t         ngx_gmtoff;
 
 
 #endif /* _NGX_TIMES_H_INCLUDED_ */
diff --git a/src/core/ngx_unix_domain.c b/src/core/ngx_unix_domain.c
index 3df83bb..a7fdd63 100644
--- a/src/core/ngx_unix_domain.c
+++ b/src/core/ngx_unix_domain.c
@@ -14,8 +14,8 @@
 #undef sun
 
 
-ngx_peers_t *ngx_unix_upstream_parse(ngx_conf_t *cf,
-                                     ngx_unix_domain_upstream_t *u)
+ngx_peers_t *
+ngx_unix_upstream_parse(ngx_conf_t *cf, ngx_unix_domain_upstream_t *u)
 {
     size_t               len;
     ngx_uint_t           i;