aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-10-21 16:49:56 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-10-21 16:49:56 +0000
commit419f9aceb4d994c2f7f51400f59fb2da0ed666d4 (patch)
treee32162d1d3833491fc1a95780880099f2ef6857f /src/http/ngx_http_core_module.c
parent9760a1336f0eb4057b6e2ccdd4b0145087102b17 (diff)
downloadnginx-419f9aceb4d994c2f7f51400f59fb2da0ed666d4.tar.gz
nginx-419f9aceb4d994c2f7f51400f59fb2da0ed666d4.zip
nginx-0.0.1-2003-10-21-20:49:56 import
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 4e3b43c5e..73d089574 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -130,13 +130,6 @@ static ngx_command_t ngx_http_core_commands[] = {
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 @@ void ngx_http_handler(ngx_http_request_t *r)
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 @@ static void ngx_http_run_phases(ngx_http_request_t *r)
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 @@ ngx_log_debug(r->connection->log, "rc: %d" _ rc);
}
}
- 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 @@ static void *ngx_http_core_create_loc_conf(ngx_conf_t *cf)
*/
- 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 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
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);