aboutsummaryrefslogtreecommitdiffstats
path: root/main/lighttpd/0002-use-keep-alive-timeout-while-waiting-for-HTTP-header.patch
blob: 13774eb4e6e461d49f7768d9137c0f14e0d831a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 3605a3bec31f5e1bc79fdfb830b84e188f060982 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <stbuehler@web.de>
Date: Wed, 2 Apr 2014 10:04:11 +0000
Subject: [PATCH 02/29] use keep-alive timeout while waiting for HTTP headers;
 use always the read timeout while waiting for the HTTP body
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2962 152afb58-edef-0310-8abb-c4023f1b3aa9
---
 NEWS         |  2 +-
 src/server.c | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index b9bd48f..e82b90b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ NEWS
 ====
 
 - 1.4.36
-  *
+  * use keep-alive timeout while waiting for HTTP headers; use always the read timeout while waiting for the HTTP body
 
 - 1.4.35 - 2014-03-12
   * [network/ssl] fix build error if TLSEXT is disabled
diff --git a/src/server.c b/src/server.c
index 5691921..d47fd62 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1296,23 +1296,25 @@ int main (int argc, char **argv) {
 
 					if (con->state == CON_STATE_READ ||
 					    con->state == CON_STATE_READ_POST) {
-						if (con->request_count == 1) {
+						if (con->request_count == 1 || con->state == CON_STATE_READ_POST) {
 							if (srv->cur_ts - con->read_idle_ts > con->conf.max_read_idle) {
 								/* time - out */
-#if 0
-								log_error_write(srv, __FILE__, __LINE__, "sd",
-										"connection closed - read-timeout:", con->fd);
-#endif
+								if (con->conf.log_request_handling) {
+									log_error_write(srv, __FILE__, __LINE__, "sd",
+										"connection closed - read timeout:", con->fd);
+								}
+
 								connection_set_state(srv, con, CON_STATE_ERROR);
 								changed = 1;
 							}
 						} else {
 							if (srv->cur_ts - con->read_idle_ts > con->keep_alive_idle) {
 								/* time - out */
-#if 0
-								log_error_write(srv, __FILE__, __LINE__, "sd",
-										"connection closed - read-timeout:", con->fd);
-#endif
+								if (con->conf.log_request_handling) {
+									log_error_write(srv, __FILE__, __LINE__, "sd",
+										"connection closed - keep-alive timeout:", con->fd);
+								}
+
 								connection_set_state(srv, con, CON_STATE_ERROR);
 								changed = 1;
 							}
-- 
2.4.5