nginx-0.0.1-2003-05-16-19:27:48 import
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index 4af3c94..2a236ee 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -47,8 +47,8 @@
 
 
 ngx_module_t  ngx_http_index_module = {
-    0,                                     /* module index */
     &ngx_http_index_module_ctx,            /* module context */
+    0,                                     /* module index */
     ngx_http_index_commands,               /* module directives */
     NGX_HTTP_MODULE_TYPE,                  /* module type */
     ngx_http_index_init                    /* init module */
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 95a7459..17c3da5 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -53,15 +53,15 @@
 
 
 ngx_module_t  ngx_http_module = {
-    0,                                     /* module index */
     &http_name,                            /* module context */
+    0,                                     /* module index */
     ngx_http_commands,                     /* module directives */
     NGX_CORE_MODULE_TYPE,                  /* module type */
     NULL                                   /* init module */
 };
 
 
-static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy)
+static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *conf)
 {
     int                         i, s, l, p, a, n, start;
     int                         port_found, addr_found, virtual_names;
@@ -70,7 +70,7 @@
     ngx_array_t                 in_ports;
     ngx_listen_t               *ls;
     ngx_http_module_t          *module;
-    ngx_conf_t                  prev;
+    ngx_conf_t                  pcf;
     ngx_http_conf_ctx_t        *ctx;
     ngx_http_in_port_t         *in_port, *inport;
     ngx_http_in_addr_t         *in_addr, *inaddr;
@@ -85,6 +85,8 @@
                   ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
                   NGX_CONF_ERROR);
 
+    *(ngx_http_conf_ctx_t **) conf = ctx;
+
     ngx_http_max_module = 0;
     for (i = 0; ngx_modules[i]; i++) {
         if (ngx_modules[i]->type != NGX_HTTP_MODULE_TYPE) {
@@ -96,7 +98,20 @@
         module->index = ngx_http_max_module++;
     }
 
-    /* null loc_conf */
+    /* TODO: http main_conf */
+
+    ngx_test_null(ctx->main_conf,
+                  ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
+                  NGX_CONF_ERROR);
+
+    /* TODO: http srv_conf */
+
+    ngx_test_null(ctx->srv_conf,
+                  ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
+                  NGX_CONF_ERROR);
+
+    /* http null loc_conf */
+
     ngx_test_null(ctx->loc_conf,
                   ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
                   NGX_CONF_ERROR);
@@ -115,12 +130,12 @@
         }
     }
 
-    prev = *cf;
+    pcf = *cf;
     cf->ctx = ctx;
     cf->module_type = NGX_HTTP_MODULE_TYPE;
     cf->cmd_type = NGX_HTTP_MAIN_CONF;
     rv = ngx_conf_parse(cf, NULL);
-    *cf = prev;
+    *cf = pcf;
 
     if (rv != NGX_CONF_OK)
         return rv;
diff --git a/src/http/ngx_http_config.h b/src/http/ngx_http_config.h
index 34890f9..370b7db 100644
--- a/src/http/ngx_http_config.h
+++ b/src/http/ngx_http_config.h
@@ -7,6 +7,7 @@
 
 
 typedef struct {
+    void        **main_conf;
     void        **srv_conf;
     void        **loc_conf;
 } ngx_http_conf_ctx_t;
@@ -38,20 +39,19 @@
 #define NGX_HTTP_LOC_CONF         0x8000000
 
 
-#define NGX_HTTP_SRV_CONF_OFFSET  offsetof(ngx_http_conf_ctx_t, srv_conf)
-#define NGX_HTTP_LOC_CONF_OFFSET  offsetof(ngx_http_conf_ctx_t, loc_conf)
+#define NGX_HTTP_MAIN_CONF_OFFSET  offsetof(ngx_http_conf_ctx_t, main_conf)
+#define NGX_HTTP_SRV_CONF_OFFSET   offsetof(ngx_http_conf_ctx_t, srv_conf)
+#define NGX_HTTP_LOC_CONF_OFFSET   offsetof(ngx_http_conf_ctx_t, loc_conf)
 
 
-#define ngx_http_get_module_srv_conf(r, module)  r->srv_conf[module.index]
-#define ngx_http_get_module_loc_conf(r, module)  r->loc_conf[module.index]
+#define ngx_http_get_module_main_conf(r, ctx)  r->main_conf[ctx.index]
+#define ngx_http_get_module_srv_conf(r, ctx)   r->srv_conf[ctx.index]
+#define ngx_http_get_module_loc_conf(r, ctx)   r->loc_conf[ctx.index]
 
 
 int ngx_http_config_modules(ngx_pool_t *pool, ngx_module_t **modules);
 
 
-extern ngx_module_t  ngx_http_module;
-
-
 extern int (*ngx_http_top_header_filter) (ngx_http_request_t *r);
 
 
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index d80567b..19bafda 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -74,8 +74,8 @@
     {ngx_string("client_header_buffer_size"),
      NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
      ngx_conf_set_size_slot,
-     0,
-     addressof(ngx_http_client_header_buffer_size),
+     NGX_HTTP_MAIN_CONF_OFFSET,
+     offsetof(ngx_http_core_main_conf_t, client_header_buffer_size),
      NULL},
 
     {ngx_string("large_client_header"),
@@ -157,8 +157,8 @@
 
 
 ngx_module_t  ngx_http_core_module = {
-    0,                                     /* module index */
     &ngx_http_core_module_ctx,             /* module context */
+    0,                                     /* module index */
     ngx_http_core_commands,                /* module directives */
     NGX_HTTP_MODULE_TYPE,                  /* module type */
     ngx_http_core_init                     /* init module */
@@ -615,7 +615,7 @@
     char                       *rv;
     ngx_http_module_t          *module;
     ngx_conf_t                  pcf;
-    ngx_http_conf_ctx_t        *ctx, *pctx;
+    ngx_http_conf_ctx_t        *ctx, *tctx, *pctx;
     ngx_http_core_srv_conf_t   *scf;
     ngx_http_core_loc_conf_t  **plcf;
 
@@ -623,12 +623,17 @@
                   ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
                   NGX_CONF_ERROR);
 
-    /* server config */
+    tctx = (ngx_http_conf_ctx_t *) cf->ctx;
+    ctx->main_conf = tctx->main_conf;
+
+    /* server configuration */
+
     ngx_test_null(ctx->srv_conf,
                   ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
                   NGX_CONF_ERROR);
 
-    /* server location config */
+    /* server location configuration */
+
     ngx_test_null(ctx->loc_conf,
                   ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
                   NGX_CONF_ERROR);
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 48de146..d44a86c 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -18,6 +18,12 @@
 
 
 typedef struct {
+    int          request_pool_size;
+    int          client_header_buffer_size;
+} ngx_http_core_main_conf_t;
+
+
+typedef struct {
     ngx_array_t  locations;    /* array of ngx_http_core_loc_conf_t */
 
     ngx_array_t  listen;       /* 'listen', array of ngx_http_listen_t */
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index 1b83fc4..926a286 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -30,8 +30,8 @@
 
 
 ngx_module_t  ngx_http_header_filter_module = {
-    0,                                     /* module index */
     &ngx_http_header_filter_module_ctx,    /* module context */
+    0,                                     /* module index */
     NULL,                                  /* module directives */
     NGX_HTTP_MODULE_TYPE,                  /* module type */
     ngx_http_header_filter_init            /* init module */
diff --git a/src/http/ngx_http_output_filter.c b/src/http/ngx_http_output_filter.c
index 2a7ada7..738c383 100644
--- a/src/http/ngx_http_output_filter.c
+++ b/src/http/ngx_http_output_filter.c
@@ -45,8 +45,8 @@
 
 
 ngx_module_t  ngx_http_output_filter_module = {
-    0,                                     /* module index */
     &ngx_http_output_filter_module_ctx,    /* module context */
+    0,                                     /* module index */
     ngx_http_output_filter_commands,       /* module directives */
     NGX_HTTP_MODULE_TYPE,                  /* module type */
     NULL                                   /* init module */
diff --git a/src/http/ngx_http_write_filter.c b/src/http/ngx_http_write_filter.c
index 752a932..31303d4 100644
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -44,8 +44,8 @@
 
 
 ngx_module_t  ngx_http_write_filter_module = {
-    0,                                     /* module index */
     &ngx_http_write_filter_module_ctx,     /* module context */
+    0,                                     /* module index */
     ngx_http_write_filter_commands,        /* module directives */
     NGX_HTTP_MODULE_TYPE,                  /* module type */
     ngx_http_write_filter_init             /* init module */