summaryrefslogtreecommitdiff
path: root/server/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/connection.c')
-rw-r--r--server/connection.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/server/connection.c b/server/connection.c
index 6e4495f8..fadf08d3 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -83,10 +83,10 @@ AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c)
}
/* we now proceed to read from the client until we get EOF, or until
- * MAX_SECS_TO_LINGER has passed. the reasons for doing this are
+ * MAX_SECS_TO_LINGER has passed. The reasons for doing this are
* documented in a draft:
*
- * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
+ * http://tools.ietf.org/html/draft-ietf-http-connection-00.txt
*
* in a nutshell -- if we don't make this effort we risk causing
* TCP RST packets to be sent which can tear down a connection before
@@ -141,7 +141,7 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
{
char dummybuf[512];
apr_size_t nbytes;
- apr_time_t timeup = 0;
+ apr_time_t now, timeup = 0;
apr_socket_t *csd = ap_get_conn_socket(c);
if (ap_start_lingering_close(c)) {
@@ -165,6 +165,7 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
if (apr_socket_recv(csd, dummybuf, &nbytes) || nbytes == 0)
break;
+ now = apr_time_now();
if (timeup == 0) {
/*
* First time through;
@@ -175,14 +176,14 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
* DoS attacks.
*/
if (apr_table_get(c->notes, "short-lingering-close")) {
- timeup = apr_time_now() + apr_time_from_sec(SECONDS_TO_LINGER);
+ timeup = now + apr_time_from_sec(SECONDS_TO_LINGER);
}
else {
- timeup = apr_time_now() + apr_time_from_sec(MAX_SECS_TO_LINGER);
+ timeup = now + apr_time_from_sec(MAX_SECS_TO_LINGER);
}
continue;
}
- } while (apr_time_now() < timeup);
+ } while (now < timeup);
apr_socket_close(csd);
return;