nginx-0.0.1-2003-05-23-15:53:01 import
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 2544436..4b182d4 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -462,12 +462,12 @@
             ls->addr = offsetof(struct sockaddr_in, sin_addr);
             ls->addr_text_max_len = INET_ADDRSTRLEN;
             ls->backlog = -1;
-            ls->post_accept_timeout = cmcf->post_accept_timeout;
             ls->nonblocking = 1;
 
             ls->handler = ngx_http_init_connection;
             ls->log = cf->log;
             ls->pool_size = cmcf->connection_pool_size;
+            ls->post_accept_timeout = cmcf->post_accept_timeout;
             ls->ctx = ctx;
 
             if (in_port[p].addrs.nelts > 1) {
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index e9bda7a..00dc072 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -49,13 +49,6 @@
      0,
      NULL,},
 
-    {ngx_string("post_accept_timeout"),
-     NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
-     ngx_conf_set_msec_slot,
-     NGX_HTTP_MAIN_CONF_OFFSET,
-     offsetof(ngx_http_core_main_conf_t, post_accept_timeout),
-     NULL},
-
     {ngx_string("connection_pool_size"),
      NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
      ngx_conf_set_size_slot,
@@ -63,32 +56,39 @@
      offsetof(ngx_http_core_main_conf_t, connection_pool_size),
      NULL},
 
-    {ngx_string("request_pool_size"),
-     NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
-     ngx_conf_set_size_slot,
-     NGX_HTTP_MAIN_CONF_OFFSET,
-     offsetof(ngx_http_core_main_conf_t, request_pool_size),
-     NULL},
-
-    {ngx_string("client_header_timeout"),
+    {ngx_string("post_accept_timeout"),
      NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
      ngx_conf_set_msec_slot,
      NGX_HTTP_MAIN_CONF_OFFSET,
-     offsetof(ngx_http_core_main_conf_t, client_header_timeout),
+     offsetof(ngx_http_core_main_conf_t, post_accept_timeout),
+     NULL},
+
+    {ngx_string("request_pool_size"),
+     NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
+     ngx_conf_set_size_slot,
+     NGX_HTTP_SRV_CONF_OFFSET,
+     offsetof(ngx_http_core_srv_conf_t, request_pool_size),
+     NULL},
+
+    {ngx_string("client_header_timeout"),
+     NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
+     ngx_conf_set_msec_slot,
+     NGX_HTTP_SRV_CONF_OFFSET,
+     offsetof(ngx_http_core_srv_conf_t, client_header_timeout),
      NULL},
 
     {ngx_string("client_header_buffer_size"),
-     NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
+     NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
      ngx_conf_set_size_slot,
-     NGX_HTTP_MAIN_CONF_OFFSET,
-     offsetof(ngx_http_core_main_conf_t, client_header_buffer_size),
+     NGX_HTTP_SRV_CONF_OFFSET,
+     offsetof(ngx_http_core_srv_conf_t, client_header_buffer_size),
      NULL},
 
     {ngx_string("large_client_header"),
-     NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG,
+     NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
      ngx_conf_set_flag_slot,
-     NGX_HTTP_MAIN_CONF_OFFSET,
-     offsetof(ngx_http_core_main_conf_t, large_client_header),
+     NGX_HTTP_SRV_CONF_OFFSET,
+     offsetof(ngx_http_core_srv_conf_t, large_client_header),
      NULL},
 
     {ngx_string("location"),
@@ -814,12 +814,8 @@
                   ngx_palloc(pool, sizeof(ngx_http_core_main_conf_t)), 
                   NGX_CONF_ERROR);
 
-    cmcf->post_accept_timeout = NGX_CONF_UNSET;
     cmcf->connection_pool_size = NGX_CONF_UNSET;
-    cmcf->request_pool_size = NGX_CONF_UNSET;
-    cmcf->client_header_timeout = NGX_CONF_UNSET;
-    cmcf->client_header_buffer_size = NGX_CONF_UNSET;
-    cmcf->large_client_header = NGX_CONF_UNSET;
+    cmcf->post_accept_timeout = NGX_CONF_UNSET;
 
     ngx_init_array(cmcf->servers, pool, 5, sizeof(ngx_http_core_srv_conf_t *),
                    NGX_CONF_ERROR);
@@ -832,12 +828,8 @@
 {
     ngx_http_core_main_conf_t *cmcf = (ngx_http_core_main_conf_t *) conf;
 
-    ngx_conf_init_msec_value(cmcf->post_accept_timeout, 30000);
     ngx_conf_init_size_value(cmcf->connection_pool_size, 16384);
-    ngx_conf_init_size_value(cmcf->request_pool_size, 16384);
-    ngx_conf_init_msec_value(cmcf->client_header_timeout, 60000);
-    ngx_conf_init_size_value(cmcf->client_header_buffer_size, 1024);
-    ngx_conf_init_value(cmcf->large_client_header, 1);
+    ngx_conf_init_msec_value(cmcf->post_accept_timeout, 30000);
 
     return NGX_CONF_OK;
 }
@@ -857,6 +849,11 @@
     ngx_init_array(cscf->server_names, pool, 5, sizeof(ngx_http_server_name_t),
                    NGX_CONF_ERROR);
 
+    cscf->request_pool_size = NGX_CONF_UNSET;
+    cscf->client_header_timeout = NGX_CONF_UNSET;
+    cscf->client_header_buffer_size = NGX_CONF_UNSET;
+    cscf->large_client_header = NGX_CONF_UNSET;
+
     return cscf;
 }
 
@@ -895,6 +892,15 @@
         n->core_srv_conf = conf;
     }
 
+    ngx_conf_merge_size_value(conf->request_pool_size,
+                              prev->request_pool_size, 16384);
+    ngx_conf_merge_msec_value(conf->client_header_timeout,
+                              prev->client_header_timeout, 60000);
+    ngx_conf_merge_size_value(conf->client_header_buffer_size,
+                              prev->client_header_buffer_size, 1024);
+    ngx_conf_merge_value(conf->large_client_header,
+                         prev->large_client_header, 1);
+
     return NGX_CONF_OK;
 }
 
@@ -984,17 +990,15 @@
     }
 
     ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
-
     ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 10000);
-
     ngx_conf_merge_size_value(conf->discarded_buffer_size,
                               prev->discarded_buffer_size, 1500);
-    ngx_conf_merge_msec_value(conf->keepalive_timeout, prev->keepalive_timeout,
-                              70000);
-    ngx_conf_merge_msec_value(conf->lingering_time, prev->lingering_time,
-                              30000);
-    ngx_conf_merge_msec_value(conf->lingering_timeout, prev->lingering_timeout,
-                              5000);
+    ngx_conf_merge_msec_value(conf->keepalive_timeout,
+                              prev->keepalive_timeout, 70000);
+    ngx_conf_merge_msec_value(conf->lingering_time,
+                              prev->lingering_time, 30000);
+    ngx_conf_merge_msec_value(conf->lingering_timeout,
+                              prev->lingering_timeout, 5000);
 
     return NGX_CONF_OK;
 }
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 2a94ea4..ad56617 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -18,13 +18,8 @@
 
 
 typedef struct {
-    int          post_accept_timeout;
     int          connection_pool_size;
-    int          request_pool_size;
-    int          client_header_timeout;
-    int          client_header_buffer_size;
-    int          large_client_header;
-    int          url_in_error_log;
+    int          post_accept_timeout;
 
     ngx_array_t  servers;      /* array of ngx_http_core_srv_conf_t */
 } ngx_http_core_main_conf_t;
@@ -40,6 +35,11 @@
                                   array of ngx_http_server_name_t */
 
     ngx_http_conf_ctx_t *ctx;  /* server ctx */
+
+    size_t       request_pool_size;
+    ngx_msec_t   client_header_timeout;
+    size_t       client_header_buffer_size;
+    int          large_client_header;
 } ngx_http_core_srv_conf_t;
 
 
diff --git a/src/http/ngx_http_event.c b/src/http/ngx_http_event.c
index f3f332a..bd733a3 100644
--- a/src/http/ngx_http_event.c
+++ b/src/http/ngx_http_event.c
@@ -58,9 +58,9 @@
 static ngx_http_header_t headers_in[] = {
     { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host) },
     { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection) },
-    { ngx_string("If-Modified-Since"), 
+    { ngx_string("If-Modified-Since"),
                          offsetof(ngx_http_headers_in_t, if_modified_since) },
-    { ngx_string("Content-Length"), 
+    { ngx_string("Content-Length"),
                             offsetof(ngx_http_headers_in_t, content_length) },
 
 #if 0
@@ -75,9 +75,10 @@
 
 void ngx_http_init_connection(ngx_connection_t *c)
 {
-    int                  event;
-    ngx_event_t         *rev;
-    ngx_http_log_ctx_t  *lcx;
+    int                   event;
+    ngx_event_t          *rev;
+    ngx_http_log_ctx_t   *lcx;
+    ngx_http_conf_ctx_t  *ctx;
 
     c->addr_text.data = ngx_palloc(c->pool, c->addr_text_max_len);
     if (c->addr_text.data == NULL) {
@@ -138,19 +139,20 @@
 
 static void ngx_http_init_request(ngx_event_t *rev)
 {
-    ngx_connection_t           *c;
-    ngx_http_request_t         *r;
-    ngx_http_conf_ctx_t        *ctx;
-    ngx_http_core_main_conf_t  *cmcf;
+    ngx_connection_t          *c;
+    ngx_http_request_t        *r;
+    ngx_http_conf_ctx_t       *ctx;
+    ngx_http_core_srv_conf_t  *cscf;
 
     c = rev->data;
     ctx = c->ctx;
 
-    cmcf = ngx_http_get_module_main_conf(ctx, ngx_http_core_module_ctx);
+    cscf = ngx_http_get_module_srv_conf(ctx, ngx_http_core_module_ctx);
+    cscf = ngx_http_get_module_srv_conf(cscf->ctx, ngx_http_core_module_ctx);
 
     if (c->buffer == NULL) {
         c->buffer = ngx_create_temp_hunk(c->pool,
-                                         cmcf->client_header_buffer_size,
+                                         cscf->client_header_buffer_size,
                                          0, 0);
         if (c->buffer == NULL) {
             ngx_http_close_connection(c);
@@ -164,7 +166,7 @@
         return;
     }
 
-    r->pool = ngx_create_pool(cmcf->request_pool_size, c->log);
+    r->pool = ngx_create_pool(cscf->request_pool_size, c->log);
     if (r->pool == NULL) {
         ngx_http_close_connection(c);
         return;
@@ -207,12 +209,12 @@
 
 static void ngx_http_process_request_line(ngx_event_t *rev)
 {
-    int                         rc, offset;
-    ssize_t                     n;
-    ngx_connection_t           *c;
-    ngx_http_request_t         *r;
-    ngx_http_log_ctx_t         *lcx;
-    ngx_http_core_main_conf_t  *cmcf;
+    int                        rc, offset;
+    ssize_t                    n;
+    ngx_connection_t          *c;
+    ngx_http_request_t        *r;
+    ngx_http_log_ctx_t        *lcx;
+    ngx_http_core_srv_conf_t  *cscf;
 
     c = rev->data;
     r = c->data;
@@ -237,10 +239,10 @@
 
         /* the request line has been parsed successfully */
 
-        cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
+        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module_ctx);
 
         if (r->http_version >= NGX_HTTP_VERSION_10
-            && cmcf->large_client_header == 0
+            && cscf->large_client_header == 0
             && r->header_in->pos == r->header_in->end)
         {
             /* no space for "\r\n" at the end of the header */
@@ -289,7 +291,7 @@
         /* if the large client headers are enabled then
            we need to copy a request line */
 
-        if (cmcf->large_client_header) {
+        if (cscf->large_client_header) {
 
             r->request_line.data = ngx_palloc(r->pool, r->request_line.len + 1);
             if (r->request_line.data == NULL) {
@@ -367,7 +369,7 @@
         lcx->url = r->unparsed_uri.data;
         r->headers_in.headers = ngx_create_table(r->pool, 10);
 
-        if (cmcf->large_client_header
+        if (cscf->large_client_header
             && r->header_in->pos == r->header_in->last)
         {
             r->header_in->pos = r->header_in->last = r->header_in->start;
@@ -398,9 +400,9 @@
            are enabled otherwise a request line had been already copied
            to the start of the r->header_in hunk in ngx_http_set_keepalive() */
 
-        cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
+        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module_ctx);
 
-        if (cmcf->large_client_header) {
+        if (cscf->large_client_header) {
             offset = r->request_start - r->header_in->start;
 
             if (offset == 0) {
@@ -438,14 +440,14 @@
 
 static void ngx_http_process_request_headers(ngx_event_t *rev)
 {
-    int                         rc, i, offset;
-    size_t                      len;
-    ssize_t                     n;
-    ngx_table_elt_t            *h;
-    ngx_connection_t           *c;
-    ngx_http_request_t         *r;
-    ngx_http_log_ctx_t         *ctx;
-    ngx_http_core_main_conf_t  *cmcf;
+    int                        rc, i, offset;
+    size_t                     len;
+    ssize_t                    n;
+    ngx_table_elt_t           *h;
+    ngx_connection_t          *c;
+    ngx_http_request_t        *r;
+    ngx_http_log_ctx_t        *ctx;
+    ngx_http_core_srv_conf_t  *cscf;
 
     c = rev->data;
     r = c->data;
@@ -488,9 +490,9 @@
             /* if the large client headers are enabled then
                we need to copy the header name and value */
 
-            cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
+            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module_ctx);
 
-            if (cmcf->large_client_header) {
+            if (cscf->large_client_header) {
                 h->key.data = ngx_palloc(r->pool,
                                          h->key.len + 1 + h->value.len + 1);
                 if (h->key.data == NULL) {
@@ -524,7 +526,7 @@
             ngx_log_debug(r->connection->log, "HTTP header: '%s: %s'" _
                           h->key.data _ h->value.data);
 
-            if (cmcf->large_client_header
+            if (cscf->large_client_header
                 && r->header_in->pos == r->header_in->last)
             {
                 r->header_in->pos = r->header_in->last = r->header_in->start;
@@ -593,9 +595,9 @@
             /* if the large client headers are enabled then
                 we need to compact r->header_in hunk */
 
-            cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
+            cscf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
 
-            if (cmcf->large_client_header) {
+            if (cscf->large_client_header) {
                 offset = r->header_name_start - r->header_in->start;
 
                 if (offset == 0) {
@@ -627,10 +629,10 @@
 
 static ssize_t ngx_http_read_request_header(ngx_http_request_t *r)
 {
-    int                         event;
-    ssize_t                     n;
-    ngx_event_t                *rev;
-    ngx_http_core_main_conf_t  *cmcf;
+    int                        event;
+    ssize_t                    n;
+    ngx_event_t               *rev;
+    ngx_http_core_srv_conf_t  *cscf;
 
     n = r->header_in->last - r->header_in->pos;
 
@@ -651,9 +653,9 @@
                 rev->timer_set = 1;
             }
 
-            cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
+            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module_ctx);
 
-            ngx_add_timer(rev, cmcf->client_header_timeout);
+            ngx_add_timer(rev, cscf->client_header_timeout);
             r->header_timeout_set = 1;
         }
 
@@ -913,7 +915,7 @@
                 return NGX_OK;
             }
         }
- 
+
         rev->event_handler = ngx_http_read_discarded_body_event;
 
         if (rev->blocked) {
@@ -991,13 +993,13 @@
 
 static void ngx_http_set_keepalive(ngx_http_request_t *r)
 {
-    int                         len, blocked;
-    ngx_hunk_t                 *h;
-    ngx_event_t                *rev, *wev;
-    ngx_connection_t           *c;
-    ngx_http_log_ctx_t         *ctx;
-    ngx_http_core_main_conf_t  *cmcf;
-    ngx_http_core_loc_conf_t   *clcf;
+    int                        len, blocked;
+    ngx_hunk_t                *h;
+    ngx_event_t               *rev, *wev;
+    ngx_connection_t          *c;
+    ngx_http_log_ctx_t        *ctx;
+    ngx_http_core_srv_conf_t  *cscf;
+    ngx_http_core_loc_conf_t  *clcf;
 
     c = (ngx_connection_t *) r->connection;
     rev = c->read;
@@ -1043,10 +1045,10 @@
            This copy should be rare because clients that support
            pipelined requests (Mozilla 1.x, Opera 6.x) are still rare */
 
-        cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module_ctx);
+        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module_ctx);
 
-        if (!cmcf->large_client_header) {
-            len = h->last - h->pos; 
+        if (!cscf->large_client_header) {
+            len = h->last - h->pos;
             ngx_memcpy(h->start, h->pos, len);
             h->pos = h->start;
             h->last = h->start + len;
diff --git a/src/http/ngx_http_output_filter.c b/src/http/ngx_http_output_filter.c
index 53699ff..d85a124 100644
--- a/src/http/ngx_http_output_filter.c
+++ b/src/http/ngx_http_output_filter.c
@@ -150,8 +150,6 @@
             return rc;
         }
 
-ngx_log_debug(r->connection->log, "HERE");
-
         /* NGX_OK */
         /* set our hunk free */
         ctx->hunk->pos = ctx->hunk->last = ctx->hunk->start;