Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 153:c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 21 Oct 2003 16:49:56 +0000 |
parents | fb48bf4fea1c |
children | eac26585476e |
comparison
equal
deleted
inserted
replaced
152:fb48bf4fea1c | 153:c71aeb75c071 |
---|---|
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 | |
140 {ngx_string("send_timeout"), | 133 {ngx_string("send_timeout"), |
141 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 134 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
142 ngx_conf_set_msec_slot, | 135 ngx_conf_set_msec_slot, |
143 NGX_HTTP_LOC_CONF_OFFSET, | 136 NGX_HTTP_LOC_CONF_OFFSET, |
144 offsetof(ngx_http_core_loc_conf_t, send_timeout), | 137 offsetof(ngx_http_core_loc_conf_t, send_timeout), |
205 r->connection->unexpected_eof = 0; | 198 r->connection->unexpected_eof = 0; |
206 | 199 |
207 lcx = r->connection->log->data; | 200 lcx = r->connection->log->data; |
208 lcx->action = NULL; | 201 lcx->action = NULL; |
209 | 202 |
210 /* STUB */ | 203 switch (r->headers_in.connection_type) { |
211 r->keepalive = 1; | 204 case 0: |
212 if (r->headers_in.connection) { | 205 if (r->http_version > NGX_HTTP_VERSION_10) { |
213 if (r->headers_in.connection->value.len == 5 | 206 r->keepalive = 1; |
214 && ngx_strcasecmp(r->headers_in.connection->value.data, "close") | 207 } else { |
215 == 0) | |
216 { | |
217 r->keepalive = 0; | 208 r->keepalive = 0; |
218 } | 209 } |
210 break; | |
211 | |
212 case NGX_HTTP_CONNECTION_CLOSE: | |
213 r->keepalive = 0; | |
214 break; | |
215 | |
216 case NGX_HTTP_CONNECTION_KEEP_ALIVE: | |
217 r->keepalive = 1; | |
218 break; | |
219 } | 219 } |
220 | 220 |
221 #if 0 | 221 #if 0 |
222 /* TEST STUB */ r->keepalive = 0; | 222 /* TEST STUB */ r->keepalive = 0; |
223 #endif | 223 #endif |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 int ngx_http_find_location_config(ngx_http_request_t *r) | 332 int ngx_http_find_location_config(ngx_http_request_t *r) |
333 { | 333 { |
334 int i, rc; | 334 int i, rc; |
335 ngx_http_core_loc_conf_t *clcf, **clcfp; | 335 ngx_http_core_loc_conf_t *clcf, **clcfp; |
336 ngx_http_core_srv_conf_t *cscf; | 336 ngx_http_core_srv_conf_t *cscf; |
337 ngx_http_write_filter_conf_t *wcf; | |
337 | 338 |
338 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | 339 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
339 | 340 |
340 clcfp = cscf->locations.elts; | 341 clcfp = cscf->locations.elts; |
341 for (i = 0; i < cscf->locations.nelts; i++) { | 342 for (i = 0; i < cscf->locations.nelts; i++) { |
361 r->connection->log->file = clcf->err_log->file; | 362 r->connection->log->file = clcf->err_log->file; |
362 r->connection->log->log_level = clcf->err_log->log_level; | 363 r->connection->log->log_level = clcf->err_log->log_level; |
363 } | 364 } |
364 } | 365 } |
365 | 366 |
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 | |
366 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); |
367 | |
368 if (!(ngx_io.flags & NGX_IO_SENDFILE) || !clcf->sendfile) { | |
369 r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY; | |
370 } | |
371 | 374 |
372 if (clcf->handler) { | 375 if (clcf->handler) { |
373 /* | 376 /* |
374 * if the location already has content handler then skip | 377 * if the location already has content handler then skip |
375 * the translation phase | 378 * the translation phase |
823 lcf->default_type.data = NULL; | 826 lcf->default_type.data = NULL; |
824 lcf->err_log = NULL; | 827 lcf->err_log = NULL; |
825 | 828 |
826 */ | 829 */ |
827 | 830 |
828 lcf->sendfile = NGX_CONF_UNSET; | |
829 | |
830 lcf->send_timeout = NGX_CONF_UNSET; | 831 lcf->send_timeout = NGX_CONF_UNSET; |
831 lcf->discarded_buffer_size = NGX_CONF_UNSET; | 832 lcf->discarded_buffer_size = NGX_CONF_UNSET; |
832 lcf->keepalive_timeout = NGX_CONF_UNSET; | 833 lcf->keepalive_timeout = NGX_CONF_UNSET; |
833 lcf->lingering_time = NGX_CONF_UNSET; | 834 lcf->lingering_time = NGX_CONF_UNSET; |
834 lcf->lingering_timeout = NGX_CONF_UNSET; | 835 lcf->lingering_timeout = NGX_CONF_UNSET; |
893 } | 894 } |
894 | 895 |
895 ngx_conf_merge_str_value(conf->default_type, | 896 ngx_conf_merge_str_value(conf->default_type, |
896 prev->default_type, "text/plain"); | 897 prev->default_type, "text/plain"); |
897 | 898 |
898 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); | |
899 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 10000); | 899 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 10000); |
900 ngx_conf_merge_size_value(conf->discarded_buffer_size, | 900 ngx_conf_merge_size_value(conf->discarded_buffer_size, |
901 prev->discarded_buffer_size, 1500); | 901 prev->discarded_buffer_size, 1500); |
902 ngx_conf_merge_msec_value(conf->keepalive_timeout, | 902 ngx_conf_merge_msec_value(conf->keepalive_timeout, |
903 prev->keepalive_timeout, 70000); | 903 prev->keepalive_timeout, 70000); |