nginx-0.0.1-2003-07-02-22:51:41 import
diff --git a/src/http/modules/ngx_http_charset_filter.c b/src/http/modules/ngx_http_charset_filter.c
index baf6d9a..bcddc92 100644
--- a/src/http/modules/ngx_http_charset_filter.c
+++ b/src/http/modules/ngx_http_charset_filter.c
@@ -12,7 +12,7 @@
 static void *ngx_http_charset_create_loc_conf(ngx_pool_t *pool);
 static char *ngx_http_charset_merge_loc_conf(ngx_pool_t *pool,
                                              void *parent, void *child);
-static int ngx_http_charset_filter_init(ngx_pool_t *pool);
+static int ngx_http_charset_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
 
 
 static ngx_command_t  ngx_http_charset_filter_commands[] = {
@@ -45,7 +45,9 @@
     &ngx_http_charset_filter_module_ctx,   /* module context */
     ngx_http_charset_filter_commands,      /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_charset_filter_init           /* init module */
+    ngx_http_charset_filter_init,          /* init module */
+    NULL,                                  /* commit module */
+    NULL                                   /* rollback module */
 };
 
 
@@ -85,7 +87,7 @@
 #endif
 
 
-static int ngx_http_charset_filter_init(ngx_pool_t *pool)
+static int ngx_http_charset_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
     next_header_filter = ngx_http_top_header_filter;
     ngx_http_top_header_filter = ngx_http_charset_header_filter;
diff --git a/src/http/modules/ngx_http_chunked_filter.c b/src/http/modules/ngx_http_chunked_filter.c
index bdd0a7c..09b480b 100644
--- a/src/http/modules/ngx_http_chunked_filter.c
+++ b/src/http/modules/ngx_http_chunked_filter.c
@@ -4,7 +4,7 @@
 #include <ngx_http.h>
 
 
-static int ngx_http_chunked_filter_init(ngx_pool_t *pool);
+static int ngx_http_chunked_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
 
 
 static ngx_http_module_t  ngx_http_chunked_filter_module_ctx = {
@@ -24,7 +24,9 @@
     &ngx_http_chunked_filter_module_ctx,   /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_chunked_filter_init           /* init module */
+    ngx_http_chunked_filter_init,          /* init module */
+    NULL,                                  /* commit module */
+    NULL                                   /* rollback module */
 };
 
 
@@ -117,7 +119,7 @@
 }
 
 
-static int ngx_http_chunked_filter_init(ngx_pool_t *pool)
+static int ngx_http_chunked_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
     next_header_filter = ngx_http_top_header_filter;
     ngx_http_top_header_filter = ngx_http_chunked_header_filter;
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index ffb9779..9af0121 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -14,7 +14,7 @@
 
 
 static int ngx_http_index_test_dir(ngx_http_request_t *r);
-static int ngx_http_index_init(ngx_pool_t *pool);
+static int ngx_http_index_init(ngx_cycle_t *cycle, ngx_log_t *log);
 static void *ngx_http_index_create_conf(ngx_pool_t *pool);
 static char *ngx_http_index_merge_conf(ngx_pool_t *p, void *parent,
                                                                   void *child);
@@ -52,7 +52,9 @@
     &ngx_http_index_module_ctx,            /* module context */
     ngx_http_index_commands,               /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_index_init                    /* init module */
+    ngx_http_index_init,                   /* init module */
+    NULL,                                  /* commit module */
+    NULL                                   /* rollback module */
 };
 
 
@@ -202,11 +204,16 @@
 }
 
 
-static int ngx_http_index_init(ngx_pool_t *pool)
+static int ngx_http_index_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
-    ngx_http_handler_pt  *h;
+    ngx_http_handler_pt        *h;
+    ngx_http_conf_ctx_t        *ctx;
+    ngx_http_core_main_conf_t  *cmcf;
 
-    ngx_test_null(h, ngx_push_array(&ngx_http_index_handlers), NGX_ERROR);
+    ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
+    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
+
+    ngx_test_null(h, ngx_push_array(&cmcf->index_handlers), NGX_ERROR);
 
     *h = ngx_http_index_handler;
 
diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c
index d0273ec..125551e 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -9,7 +9,7 @@
 } ngx_http_range_filter_ctx_t;
 
 
-static int ngx_http_range_filter_init(ngx_pool_t *pool);
+static int ngx_http_range_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
 
 
 static ngx_http_module_t  ngx_http_range_filter_module_ctx = {
@@ -29,7 +29,9 @@
     &ngx_http_range_filter_module_ctx,     /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_range_filter_init             /* init module */
+    ngx_http_range_filter_init,            /* init module */
+    NULL,                                  /* commit module */
+    NULL                                   /* rollback module */
 };
 
 
@@ -354,7 +356,7 @@
 }
 
 
-static int ngx_http_range_filter_init(ngx_pool_t *pool)
+static int ngx_http_range_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
     next_header_filter = ngx_http_top_header_filter;
     ngx_http_top_header_filter = ngx_http_range_header_filter;
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 10f0023..a1ea12a 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -11,10 +11,6 @@
 int  ngx_http_max_module;
 
 
-ngx_array_t  ngx_http_translate_handlers;
-ngx_array_t  ngx_http_index_handlers;
-
-
 int  (*ngx_http_top_header_filter) (ngx_http_request_t *r);
 int  (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
 
@@ -210,11 +206,11 @@
 
     /* init list of the handlers */
 
-    ngx_init_array(ngx_http_translate_handlers,
-                   cf->pool, 10, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
+    ngx_init_array(cmcf->translate_handlers, cf->cycle->pool,
+                   10, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
 
-    ngx_init_array(ngx_http_index_handlers,
-                   cf->pool, 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
+    ngx_init_array(cmcf->index_handlers, cf->cycle->pool,
+                   3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
 
 
     /* create the lists of the ports, the addresses and the server names
@@ -429,7 +425,7 @@
         in_addr = in_port[p].addrs.elts;
         while (a < in_port[p].addrs.nelts) {
 
-            ngx_test_null(ls, ngx_push_array(&ngx_listening_sockets),
+            ngx_test_null(ls, ngx_push_array(&cf->cycle->listening),
                           NGX_CONF_ERROR);
             ngx_memzero(ls, sizeof(ngx_listening_t));
 
@@ -453,6 +449,7 @@
                                                      INET_ADDRSTRLEN),
                                      6, ":%d", in_port[p].port);
 
+            ls->fd = -1;
             ls->family = AF_INET;
             ls->type = SOCK_STREAM;
             ls->protocol = IPPROTO_IP;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 4cc4388..8e9a966 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -422,11 +422,14 @@
 
 static int ngx_http_core_index_handler(ngx_http_request_t *r)
 {
-    int  i, rc;
-    ngx_http_handler_pt  *h;
+    int                         i, rc;
+    ngx_http_handler_pt        *h;
+    ngx_http_core_main_conf_t  *cmcf;
 
-    h = (ngx_http_handler_pt *) ngx_http_index_handlers.elts;
-    for (i = ngx_http_index_handlers.nelts; i > 0; /* void */) {
+    cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
+
+    h = cmcf->index_handlers.elts;
+    for (i = cmcf->index_handlers.nelts; i > 0; /* void */) {
         rc = h[--i](r);
 
         if (rc != NGX_DECLINED) {
@@ -528,9 +531,14 @@
 
 static int ngx_http_core_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
-    ngx_http_handler_pt  *h;
+    ngx_http_handler_pt        *h;
+    ngx_http_conf_ctx_t        *ctx;
+    ngx_http_core_main_conf_t  *cmcf;
 
-    ngx_test_null(h, ngx_push_array(&ngx_http_translate_handlers), NGX_ERROR);
+    ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
+    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
+
+    ngx_test_null(h, ngx_push_array(&cmcf->translate_handlers), NGX_ERROR);
 
     *h = ngx_http_core_translate_handler;
 
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 8acf4fe..c6b2bcc 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -20,6 +20,7 @@
 typedef struct {
     ngx_array_t  servers;              /* array of ngx_http_core_srv_conf_t */
     ngx_array_t  translate_handlers;
+    ngx_array_t  index_handlers;
 } ngx_http_core_main_conf_t;
 
 
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index 0f7c953..aa200c1 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -11,7 +11,7 @@
 
 
 
-static int ngx_http_header_filter_init(ngx_pool_t *pool);
+static int ngx_http_header_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
 static int ngx_http_header_filter(ngx_http_request_t *r);
 
 
@@ -32,7 +32,9 @@
     &ngx_http_header_filter_module_ctx,    /* module context */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_header_filter_init            /* init module */
+    ngx_http_header_filter_init,           /* init module */
+    NULL,                                  /* commit module */
+    NULL                                   /* rollback module */
 };
 
 
@@ -387,7 +389,7 @@
 }
 
 
-static int ngx_http_header_filter_init(ngx_pool_t *pool)
+static int ngx_http_header_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
     ngx_http_top_header_filter = ngx_http_header_filter;
     return NGX_OK;
diff --git a/src/http/ngx_http_write_filter.c b/src/http/ngx_http_write_filter.c
index 6b76f73..fc96b07 100644
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -18,7 +18,7 @@
 static void *ngx_http_write_filter_create_conf(ngx_pool_t *pool);
 static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool,
                                               void *parent, void *child);
-static int ngx_http_write_filter_init(ngx_pool_t *pool);
+static int ngx_http_write_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
 
 
 static ngx_command_t ngx_http_write_filter_commands[] = {
@@ -51,7 +51,9 @@
     &ngx_http_write_filter_module_ctx,     /* module context */
     ngx_http_write_filter_commands,        /* module directives */
     NGX_HTTP_MODULE,                       /* module type */
-    ngx_http_write_filter_init             /* init module */
+    ngx_http_write_filter_init,            /* init module */
+    NULL,                                  /* commit module */
+    NULL                                   /* rollback module */
 };
 
 
@@ -187,7 +189,7 @@
 }
 
 
-static int ngx_http_write_filter_init(ngx_pool_t *pool)
+static int ngx_http_write_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
 {
     ngx_http_top_body_filter = ngx_http_write_filter;