nginx-0.0.1-2003-10-21-20:49:56 import
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 4e3b43c..73d0895 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -130,13 +130,6 @@
      offsetof(ngx_http_core_loc_conf_t, doc_root),
      NULL},
 
-    {ngx_string("sendfile"),
-     NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
-     ngx_conf_set_flag_slot,
-     NGX_HTTP_LOC_CONF_OFFSET,
-     offsetof(ngx_http_core_loc_conf_t, sendfile),
-     NULL},
-
     {ngx_string("send_timeout"),
      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
      ngx_conf_set_msec_slot,
@@ -207,15 +200,22 @@
     lcx = r->connection->log->data;
     lcx->action = NULL;
 
-    /* STUB */
-    r->keepalive = 1;
-    if (r->headers_in.connection) {
-        if (r->headers_in.connection->value.len == 5
-            && ngx_strcasecmp(r->headers_in.connection->value.data, "close")
-                                                                          == 0)
-        {
+    switch (r->headers_in.connection_type) {
+    case 0:
+        if (r->http_version > NGX_HTTP_VERSION_10) {
+            r->keepalive = 1;
+        } else {
             r->keepalive = 0;
         }
+        break;
+
+    case NGX_HTTP_CONNECTION_CLOSE:
+        r->keepalive = 0;
+        break;
+
+    case NGX_HTTP_CONNECTION_KEEP_ALIVE:
+        r->keepalive = 1;
+        break;
     }
 
 #if 0
@@ -331,9 +331,10 @@
 
 int ngx_http_find_location_config(ngx_http_request_t *r)
 {
-    int                        i, rc;
-    ngx_http_core_loc_conf_t  *clcf, **clcfp;
-    ngx_http_core_srv_conf_t  *cscf;
+    int                            i, rc;
+    ngx_http_core_loc_conf_t      *clcf, **clcfp;
+    ngx_http_core_srv_conf_t      *cscf;
+    ngx_http_write_filter_conf_t  *wcf;
 
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
 
@@ -363,12 +364,14 @@
         }
     }
 
-    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+    wcf = ngx_http_get_module_loc_conf(r, ngx_http_write_filter_module);
 
-    if (!(ngx_io.flags & NGX_IO_SENDFILE) || !clcf->sendfile) {
+    if (!(ngx_io.flags & NGX_IO_SENDFILE) || !wcf->sendfile) {
         r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY;
     }
 
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
     if (clcf->handler) {
         /*
          * if the location already has content handler then skip
@@ -825,8 +828,6 @@
 
     */
 
-    lcf->sendfile = NGX_CONF_UNSET;
-
     lcf->send_timeout = NGX_CONF_UNSET;
     lcf->discarded_buffer_size = NGX_CONF_UNSET;
     lcf->keepalive_timeout = NGX_CONF_UNSET;
@@ -895,7 +896,6 @@
     ngx_conf_merge_str_value(conf->default_type,
                              prev->default_type, "text/plain");
 
-    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);