summaryrefslogtreecommitdiff
path: root/server/connection.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2011-12-27 19:43:04 +0100
committerStefan Fritsch <sf@sfritsch.de>2011-12-27 19:43:04 +0100
commit498ea95018b369e62646a98c7d7d5413b56e170c (patch)
treeb7c4798010bbb18d4d2c07f722d7fb0d38efd24c /server/connection.c
parente8bb7adda7f73e53cdab823e9cab2a49ccbdf188 (diff)
downloadapache2-498ea95018b369e62646a98c7d7d5413b56e170c.tar.gz
Upstream tarball 2.2.17upstream/2.2.17
Diffstat (limited to 'server/connection.c')
-rw-r--r--server/connection.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/server/connection.c b/server/connection.c
index d4880b0b..3db5a2e6 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -154,8 +154,20 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
break;
if (timeup == 0) {
- /* First time through; calculate now + 30 seconds. */
- timeup = apr_time_now() + apr_time_from_sec(MAX_SECS_TO_LINGER);
+ /*
+ * First time through;
+ * calculate now + 30 seconds (MAX_SECS_TO_LINGER).
+ *
+ * If some module requested a shortened waiting period, only wait
+ * for 2s (SECONDS_TO_LINGER). This is useful for mitigating
+ * certain DoS attacks.
+ */
+ if (apr_table_get(c->notes, "short-lingering-close")) {
+ timeup = apr_time_now() + apr_time_from_sec(SECONDS_TO_LINGER);
+ }
+ else {
+ timeup = apr_time_now() + apr_time_from_sec(MAX_SECS_TO_LINGER);
+ }
continue;
}
} while (apr_time_now() < timeup);