From dcd34e931fccc30e96268c25b90a0bc0daf0bf3c Mon Sep 17 00:00:00 2001 From: Daniel Earl Poirier Date: Mon, 3 May 2010 17:33:03 +0000 Subject: [PATCH] ab was sending wrong number of requests when keepalive enabled. Thanks to Bryn Dole for the patch. PR: 48497 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@940526 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ support/ab.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a7b63f680f..f6e9cb5393 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,9 @@ Changes with Apache 2.3.7 processing is completed, avoiding orphaned callback pointers. [Brett Gervasoni , Jeff Trawick] + *) ab: fix number of requests sent by ab when keepalive is enabled. PR 48497. + [Bryn Dole ] + *) Log an error for failures to read a chunk-size, and return 408 instead of 413 when this is due to a read timeout. This change also fixes some cases of two error documents being sent in the response for the same scenario. diff --git a/support/ab.c b/support/ab.c index abb3c2017c..e4e76705da 100644 --- a/support/ab.c +++ b/support/ab.c @@ -671,6 +671,10 @@ static void ssl_proceed_handshake(struct connection *c) static void write_request(struct connection * c) { + if (started >= requests) { + return; + } + do { apr_time_t tnow; apr_size_t l = c->rwrite; @@ -724,6 +728,7 @@ static void write_request(struct connection * c) } while (c->rwrite); c->endwrite = lasttime = apr_time_now(); + started++; set_conn_state(c, STATE_READ); } @@ -1267,7 +1272,6 @@ static void start_connect(struct connection * c) /* connected first time */ set_conn_state(c, STATE_CONNECTED); - started++; #ifdef USE_SSL if (c->ssl) { ssl_proceed_handshake(c); @@ -1798,7 +1802,6 @@ static void test(void) } else { set_conn_state(c, STATE_CONNECTED); - started++; #ifdef USE_SSL if (c->ssl) ssl_proceed_handshake(c); -- 2.40.0