diff options
author | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2009-10-11 13:16:26 +0000 |
---|---|---|
committer | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2009-10-11 13:16:26 +0000 |
commit | aba63f984a93c9bce0712a85e3236a4b2b394a00 (patch) | |
tree | 9fe3e30c40b50d3dd9ab25a6805411625825bc7a | |
parent | be33cfe2c3bcd17a5fdf8dac73312e6fe685510b (diff) | |
download | lighttpd-aba63f984a93c9bce0712a85e3236a4b2b394a00.tar.gz |
Remember keep-alive-idle in separate variable (fixes #1988)
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@2623 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r-- | src/base.h | 3 | ||||
-rw-r--r-- | src/response.c | 4 | ||||
-rw-r--r-- | src/server.c | 2 |
3 files changed, 6 insertions, 3 deletions
@@ -396,7 +396,8 @@ typedef struct { int is_readable; int is_writable; - int keep_alive; /* only request.c can enable it, all others just disable */ + int keep_alive; /* only request.c can enable it, all others just disable */ + int keep_alive_idle; /* remember max_keep_alive_idle from config */ int file_started; diff --git a/src/response.c b/src/response.c index 50dd5262..748c2428 100644 --- a/src/response.c +++ b/src/response.c @@ -68,8 +68,10 @@ int http_response_write_header(server *srv, connection *con, chunkqueue *raw) { if (!allow_keep_alive) con->keep_alive = 0; /* disable keep-alive if requested */ - if (con->request_count > con->conf.max_keep_alive_requests) { + if (con->request_count > con->conf.max_keep_alive_requests || 0 == con->conf.max_keep_alive_idle) { con->keep_alive = 0; + } else { + con->keep_alive_idle = con->conf.max_keep_alive_idle; } if (con->request.http_version != HTTP_VERSION_1_1 || con->keep_alive == 0) { diff --git a/src/server.c b/src/server.c index f385a28d..4df1f17e 100644 --- a/src/server.c +++ b/src/server.c @@ -744,7 +744,7 @@ static int lighty_mainloop(server *srv) { changed = 1; } } else { - if (srv->cur_ts - con->read_idle_ts > con->conf.max_keep_alive_idle) { + if (srv->cur_ts - con->read_idle_ts > con->keep_alive_idle) { /* time - out */ #if 0 TRACE("(keep-alive read timeout) [%s]", SAFE_BUF_STR(con->dst_addr_buf)); |