nginx-0.0.1-2003-04-08-19:40:10 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 895d136..36a28f8 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -36,6 +36,8 @@
 ngx_pool_t   *ngx_pool;
 
 
+int ngx_max_module;
+
 int ngx_connection_counter;
 
 ngx_array_t  ngx_listening_sockets;
@@ -68,6 +70,11 @@
     ngx_init_array(ngx_listening_sockets, ngx_pool, 10, sizeof(ngx_listen_t),
                    1);
 
+    ngx_max_module = 0;
+    for (i = 0; ngx_modules[i]; i++) {
+        ngx_modules[i]->index = ngx_max_module++;
+    }
+
     ngx_memzero(&conf, sizeof(ngx_conf_t));
     ngx_test_null(conf.args,
                   ngx_create_array(ngx_pool, 10, sizeof(ngx_str_t)), 1);
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 94d678f..df00add 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -5,6 +5,7 @@
 #define  NGINX_VER  "nginx/0.0.1"
 
 
+extern int ngx_max_module;
 extern int ngx_connection_counter;
 
 
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index de3bf75..12537bd 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -130,7 +130,7 @@
                         pconf = *(void **) ((char *) cf->ctx + cmd->conf);
 
                         if (pconf) {
-                            conf = pconf[ngx_modules[i]->index];
+                            conf = pconf[*(int *)(ngx_modules[i]->ctx)];
                         }
                     }
 
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 56ed4a1..beb148a 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -31,8 +31,8 @@
 #define NGX_CONF_FILE_DONE   2
 
 
-#define NGX_CORE_MODULE_TYPE 0x45524f43  /* "CORE" */
-#define NGX_CONF_MODULE_TYPE 0x464E4f43  /* "CONF" */
+#define NGX_CORE_MODULE_TYPE 0x45524F43  /* "CORE" */
+#define NGX_CONF_MODULE_TYPE 0x464E4F43  /* "CONF" */
 
 
 typedef struct ngx_conf_s  ngx_conf_t;
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 6b26ad8..3df0856 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -93,6 +93,7 @@
 #include <sys/uio.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <netdb.h>
 
 
 #ifndef HAVE_POLL
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index 882b256..fd5bb92 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -4,11 +4,15 @@
 
 #define  NGX_OK          0
 #define  NGX_ERROR      -1
-#define  NGX_DONE        NGX_ERROR
 #define  NGX_AGAIN      -2
+#define  NGX_DONE       -3
+/*
 #define  NGX_BUSY       -3
+*/
 #define  NGX_DECLINED   -4
+/*
 #define  NGX_ALERT      -5
+*/
 
 
 #define NGX_MAXHOSTNAMELEN 32
diff --git a/src/core/ngx_modules.c b/src/core/ngx_modules.c
index e07c4e6..165d527 100644
--- a/src/core/ngx_modules.c
+++ b/src/core/ngx_modules.c
@@ -4,28 +4,32 @@
 #include <ngx_conf_file.h>
 
 
-extern ngx_module_t  ngx_http_header_filter_module;
+extern ngx_module_t  ngx_http_module;
+extern ngx_module_t  ngx_http_core_module;
 
 extern ngx_module_t  ngx_http_write_filter_module;
 extern ngx_module_t  ngx_http_output_filter_module;
+extern ngx_module_t  ngx_http_header_filter_module;
 
-extern ngx_module_t  ngx_http_core_module;
 extern ngx_module_t  ngx_http_index_module;
-
-extern ngx_module_t  ngx_http_module;
+extern ngx_module_t  ngx_http_proxy_module;
 
 
 ngx_module_t *ngx_modules[] = {
 
-    &ngx_http_header_filter_module,
+    &ngx_http_module,
 
+    &ngx_http_core_module,
     &ngx_http_write_filter_module,
     &ngx_http_output_filter_module,
+    &ngx_http_header_filter_module,
+
+    /* &ngx_http_gzip_filter_module, */
+    /* &ngx_http_range_filter_module, */
+    /* &ngx_http_ssi_filter_module, */
 
     &ngx_http_index_module,
-    &ngx_http_core_module,
-
-    &ngx_http_module,
+    &ngx_http_proxy_module,
 
     NULL
 };