diff src/http/ngx_http_core_module.c @ 154:eac26585476e

nginx-0.0.1-2003-10-22-11:05:29 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 22 Oct 2003 07:05:29 +0000
parents c71aeb75c071
children 46eb23d9471d
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -130,6 +130,13 @@ static ngx_command_t  ngx_http_core_comm
      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 ngx_http_find_location_config(ngx_ht
     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 @@ ngx_log_debug(r->connection->log, "rc: %
         }
     }
 
-    wcf = ngx_http_get_module_loc_conf(r, ngx_http_write_filter_module);
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    if (!(ngx_io.flags & NGX_IO_SENDFILE) || !wcf->sendfile) {
-        r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY;
+    if (!(ngx_io.flags & NGX_IO_SENDFILE) || !clcf->sendfile) {
+        r->sendfile = 0;
+
+    } else {
+        r->sendfile = 1;
     }
 
-    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
     if (clcf->handler) {
         /*
          * if the location already has content handler then skip
@@ -828,6 +835,7 @@ static void *ngx_http_core_create_loc_co
 
     */
 
+    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 @@ static char *ngx_http_core_merge_loc_con
     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);