nginx-0.0.1-2003-10-22-11:05:29 import
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 73d0895..6015683 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -130,6 +130,13 @@
      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,
@@ -334,7 +341,6 @@
     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);
 
@@ -364,14 +370,15 @@
         }
     }
 
-    wcf = ngx_http_get_module_loc_conf(r, ngx_http_write_filter_module);
-
-    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 (!(ngx_io.flags & NGX_IO_SENDFILE) || !clcf->sendfile) {
+        r->sendfile = 0;
+
+    } else {
+        r->sendfile = 1;
+    }
+
     if (clcf->handler) {
         /*
          * if the location already has content handler then skip
@@ -828,6 +835,7 @@
 
     */
 
+    lcf->sendfile = NGX_CONF_UNSET;
     lcf->send_timeout = NGX_CONF_UNSET;
     lcf->discarded_buffer_size = NGX_CONF_UNSET;
     lcf->keepalive_timeout = NGX_CONF_UNSET;
@@ -896,6 +904,7 @@
     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);