comparison 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
comparison
equal deleted inserted replaced
153:c71aeb75c071 154:eac26585476e
128 ngx_conf_set_str_slot, 128 ngx_conf_set_str_slot,
129 NGX_HTTP_LOC_CONF_OFFSET, 129 NGX_HTTP_LOC_CONF_OFFSET,
130 offsetof(ngx_http_core_loc_conf_t, doc_root), 130 offsetof(ngx_http_core_loc_conf_t, doc_root),
131 NULL}, 131 NULL},
132 132
133 {ngx_string("sendfile"),
134 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
135 ngx_conf_set_flag_slot,
136 NGX_HTTP_LOC_CONF_OFFSET,
137 offsetof(ngx_http_core_loc_conf_t, sendfile),
138 NULL},
139
133 {ngx_string("send_timeout"), 140 {ngx_string("send_timeout"),
134 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 141 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
135 ngx_conf_set_msec_slot, 142 ngx_conf_set_msec_slot,
136 NGX_HTTP_LOC_CONF_OFFSET, 143 NGX_HTTP_LOC_CONF_OFFSET,
137 offsetof(ngx_http_core_loc_conf_t, send_timeout), 144 offsetof(ngx_http_core_loc_conf_t, send_timeout),
332 int ngx_http_find_location_config(ngx_http_request_t *r) 339 int ngx_http_find_location_config(ngx_http_request_t *r)
333 { 340 {
334 int i, rc; 341 int i, rc;
335 ngx_http_core_loc_conf_t *clcf, **clcfp; 342 ngx_http_core_loc_conf_t *clcf, **clcfp;
336 ngx_http_core_srv_conf_t *cscf; 343 ngx_http_core_srv_conf_t *cscf;
337 ngx_http_write_filter_conf_t *wcf;
338 344
339 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 345 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
340 346
341 clcfp = cscf->locations.elts; 347 clcfp = cscf->locations.elts;
342 for (i = 0; i < cscf->locations.nelts; i++) { 348 for (i = 0; i < cscf->locations.nelts; i++) {
362 r->connection->log->file = clcf->err_log->file; 368 r->connection->log->file = clcf->err_log->file;
363 r->connection->log->log_level = clcf->err_log->log_level; 369 r->connection->log->log_level = clcf->err_log->log_level;
364 } 370 }
365 } 371 }
366 372
367 wcf = ngx_http_get_module_loc_conf(r, ngx_http_write_filter_module);
368
369 if (!(ngx_io.flags & NGX_IO_SENDFILE) || !wcf->sendfile) {
370 r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY;
371 }
372
373 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 373 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
374
375 if (!(ngx_io.flags & NGX_IO_SENDFILE) || !clcf->sendfile) {
376 r->sendfile = 0;
377
378 } else {
379 r->sendfile = 1;
380 }
374 381
375 if (clcf->handler) { 382 if (clcf->handler) {
376 /* 383 /*
377 * if the location already has content handler then skip 384 * if the location already has content handler then skip
378 * the translation phase 385 * the translation phase
826 lcf->default_type.data = NULL; 833 lcf->default_type.data = NULL;
827 lcf->err_log = NULL; 834 lcf->err_log = NULL;
828 835
829 */ 836 */
830 837
838 lcf->sendfile = NGX_CONF_UNSET;
831 lcf->send_timeout = NGX_CONF_UNSET; 839 lcf->send_timeout = NGX_CONF_UNSET;
832 lcf->discarded_buffer_size = NGX_CONF_UNSET; 840 lcf->discarded_buffer_size = NGX_CONF_UNSET;
833 lcf->keepalive_timeout = NGX_CONF_UNSET; 841 lcf->keepalive_timeout = NGX_CONF_UNSET;
834 lcf->lingering_time = NGX_CONF_UNSET; 842 lcf->lingering_time = NGX_CONF_UNSET;
835 lcf->lingering_timeout = NGX_CONF_UNSET; 843 lcf->lingering_timeout = NGX_CONF_UNSET;
894 } 902 }
895 903
896 ngx_conf_merge_str_value(conf->default_type, 904 ngx_conf_merge_str_value(conf->default_type,
897 prev->default_type, "text/plain"); 905 prev->default_type, "text/plain");
898 906
907 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
899 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 10000); 908 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 10000);
900 ngx_conf_merge_size_value(conf->discarded_buffer_size, 909 ngx_conf_merge_size_value(conf->discarded_buffer_size,
901 prev->discarded_buffer_size, 1500); 910 prev->discarded_buffer_size, 1500);
902 ngx_conf_merge_msec_value(conf->keepalive_timeout, 911 ngx_conf_merge_msec_value(conf->keepalive_timeout,
903 prev->keepalive_timeout, 70000); 912 prev->keepalive_timeout, 70000);