ab.c revision 19ce7effbcc8a735f1a883f9266e086fde2adb63
2d2eda71267231c2526be701fe655db125852c1ffielding/* Licensed to the Apache Software Foundation (ASF) under one or more
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * contributor license agreements. See the NOTICE file distributed with
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * this work for additional information regarding copyright ownership.
b99dbaab171d91e1b664397cc40e039d0c087c65fielding * The ASF licenses this file to You under the Apache License, Version 2.0
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * (the "License"); you may not use this file except in compliance with
2d2eda71267231c2526be701fe655db125852c1ffielding * the License. You may obtain a copy of the License at
2d2eda71267231c2526be701fe655db125852c1ffielding * Unless required by applicable law or agreed to in writing, software
2d2eda71267231c2526be701fe655db125852c1ffielding * distributed under the License is distributed on an "AS IS" BASIS,
2d2eda71267231c2526be701fe655db125852c1ffielding * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2d2eda71267231c2526be701fe655db125852c1ffielding * See the License for the specific language governing permissions and
2d2eda71267231c2526be701fe655db125852c1ffielding * limitations under the License.
2d2eda71267231c2526be701fe655db125852c1ffielding ** This program is based on ZeusBench V1.0 written by Adam Twiss
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** which is Copyright (c) 1996 by Zeus Technology Ltd. http://www.zeustech.net/
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** This software is provided "as is" and any express or implied waranties,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** including but not limited to, the implied warranties of merchantability and
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** fitness for a particular purpose are disclaimed. In no event shall
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** Zeus Technology Ltd. be liable for any direct, indirect, incidental, special,
2d2eda71267231c2526be701fe655db125852c1ffielding ** exemplary, or consequential damaged (including, but not limited to,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** procurement of substitute good or services; loss of use, data, or profits;
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** or business interruption) however caused and on theory of liability. Whether
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** in contract, strict liability or tort (including negligence or otherwise)
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** arising in any way out of the use of this software, even if advised of the
2d2eda71267231c2526be701fe655db125852c1ffielding ** possibility of such damage.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** HISTORY:
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - Originally written by Adam Twiss <adam@zeus.co.uk>, March 1996
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** with input from Mike Belshe <mbelshe@netscape.com> and
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** Michael Campanella <campanella@stevms.enet.dec.com>
2d2eda71267231c2526be701fe655db125852c1ffielding ** - Enhanced by Dean Gaudet <dgaudet@apache.org>, November 1997
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - Cleaned up by Ralf S. Engelschall <rse@apache.org>, March 1998
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - POST and verbosity by Kurt Sussman <kls@merlot.com>, August 1998
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - HTML table output added by David N. Welton <davidw@prosa.it>, January 1999
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - Added Cookie, Arbitrary header and auth support. <dirkx@webweaving.org>, April 1999
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** Version 1.3d
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - Increased version number - as some of the socket/error handling has
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** fundamentally changed - and will give fundamentally different results
2d2eda71267231c2526be701fe655db125852c1ffielding ** in situations where a server is dropping requests. Therefore you can
2d2eda71267231c2526be701fe655db125852c1ffielding ** no longer compare results of AB as easily. Hence the inc of the version.
2d2eda71267231c2526be701fe655db125852c1ffielding ** They should be closer to the truth though. Sander & <dirkx@covalent.net>, End 2000.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** - Fixed proxy functionality, added median/mean statistics, added gnuplot
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** output option, added _experimental/rudimentary_ SSL support. Added
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** confidence guestimators and warnings. Sander & <dirkx@covalent.net>, End 2000
2d2eda71267231c2526be701fe655db125852c1ffielding ** - Fixed serious int overflow issues which would cause realistic (longer
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** than a few minutes) run's to have wrong (but believable) results. Added
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** trapping of connection errors which influenced measurements.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding ** Contributed by Sander Temme, Early 2001
2d2eda71267231c2526be701fe655db125852c1ffielding ** Version 1.3e
2d2eda71267231c2526be701fe655db125852c1ffielding ** - Changed timeout behavour during write to work whilst the sockets
2d2eda71267231c2526be701fe655db125852c1ffielding ** are filling up and apr_write() does writes a few - but not all.
2d2eda71267231c2526be701fe655db125852c1ffielding ** This will potentially change results. <dirkx@webweaving.org>, April 2001
2d2eda71267231c2526be701fe655db125852c1ffielding ** Version 2.0.36-dev
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** Improvements to concurrent processing:
b980ad7fdc218b4855cde9f75a747527f50c554dwrowe ** - Enabled non-blocking connect()s.
ab5581cc78e9d865b0a6ab1404c53347b3276968rbb ** - Prevent blocking calls to apr_socket_recv() (thereby allowing AB to
92f3af936ce61f25358a3ee4f28df2f6d62040dfdreid ** manage its entire set of socket descriptors).
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** - Any error returned from apr_socket_recv() that is not EAGAIN or EOF
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** is now treated as fatal.
fd0edaa8e3d4dd67d0604ccef2e96b071db96643fielding ** Contributed by Aaron Bannert, April 24, 2002
2d2eda71267231c2526be701fe655db125852c1ffielding ** Version 2.0.36-2
2d2eda71267231c2526be701fe655db125852c1ffielding ** Internalized the version string - this string is part
2d2eda71267231c2526be701fe655db125852c1ffielding ** of the Agent: header and the result output.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb ** Version 2.0.37-dev
61fd0cab072a05b855cbef9c585702401ac5ae29rbb ** Adopted SSL code by Madhu Mathihalli <madhusudan_mathihalli@hp.com>
61fd0cab072a05b855cbef9c585702401ac5ae29rbb ** [PATCH] ab with SSL support Posted Wed, 15 Aug 2001 20:55:06 GMT
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** Introduces four 'if (int == value)' tests per non-ssl request.
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** Version 2.0.40-dev
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** Switched to the new abstract pollset API, allowing ab to
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** take advantage of future apr_pollset_t scalability improvements.
2d2eda71267231c2526be701fe655db125852c1ffielding ** Contributed by Brian Pane, August 31, 2002
2d2eda71267231c2526be701fe655db125852c1ffielding ** Version 2.3
2d2eda71267231c2526be701fe655db125852c1ffielding ** SIGINT now triggers output_results().
2d2eda71267231c2526be701fe655db125852c1ffielding ** Contributed by colm, March 30, 2006
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* Note: this version string should start with \d+[\d\.]* and be a valid
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * string for an HTTP Agent: header when prefixed with 'ApacheBench/'.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * It should reflect the version of AB - and not that of the apache server
2d2eda71267231c2526be701fe655db125852c1ffielding * it happens to accompany. And it should be updated or changed whenever
2d2eda71267231c2526be701fe655db125852c1ffielding * the results are no longer fundamentally comparable to the results of
bfb62a96023822c56c9120e4ee627d4091cc59c2rbb * a previous version of ab. Either due to a change in the logic of
bfb62a96023822c56c9120e4ee627d4091cc59c2rbb * ab - or to due to a change in the distribution it is compiled with
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * (such as an APR change in for example blocking).
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * - has various other poor buffer attacks related to the lazy parsing of
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * response headers from the server
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * - doesn't implement much of HTTP/1.x, only accepts certain forms of
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * responses
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * - (performance problem) heavy use of strstr shows up top in profile
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * only an issue for loopback usage
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* -------------------------------------------------------------------- */
2d2eda71267231c2526be701fe655db125852c1ffielding/* Hmmm... This source code isn't being compiled in ASCII.
2d2eda71267231c2526be701fe655db125852c1ffielding * In order for data that flows over the network to make
2d2eda71267231c2526be701fe655db125852c1ffielding * sense, we need to translate to/from ASCII.
2d2eda71267231c2526be701fe655db125852c1ffielding/* affects include files on Solaris */
c9a95767fbf0f5fb0976a06b97a256033925e433rbb#if defined(HAVE_SSLC)
c9a95767fbf0f5fb0976a06b97a256033925e433rbb/* Libraries for RSA SSL-C */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* Libraries on most systems.. */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#if defined(USE_SSL)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* ------------------- DEFINITIONS -------------------------- */
23ff73a56371e21f16744cb94d06399b877829f1rbb/* maximum number of requests on a time limited test */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* connection state
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * don't add enums or rearrange or otherwise change values without
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * visiting set_conn_state()
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef enum {
61fd0cab072a05b855cbef9c585702401ac5ae29rbb STATE_CONNECTING, /* TCP connect initiated, but we don't
3d96ee83babeec32482c9082c9426340cee8c44dwrowe * know if it worked yet
62db15de4c1f335a64d45821796ae197cff94ef8rbb apr_size_t rwrite, rwrote; /* keep pointers in what we write - across
62db15de4c1f335a64d45821796ae197cff94ef8rbb * EAGAINs */
62db15de4c1f335a64d45821796ae197cff94ef8rbb apr_size_t length; /* Content-Length value used for keep-alive */
62db15de4c1f335a64d45821796ae197cff94ef8rbb char cbuff[CBUFFSIZE]; /* a buffer to store server response header */
62db15de4c1f335a64d45821796ae197cff94ef8rbb int gotheader; /* non-zero if we have the entire header in
62db15de4c1f335a64d45821796ae197cff94ef8rbb * cbuff */
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb apr_interval_time_t waittime; /* between request and reading response */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar#define ap_min(a,b) (((a)<(b))?(a):(b))
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar#define ap_max(a,b) (((a)>(b))?(a):(b))
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar/* --------------------- GLOBALS ---------------------------- */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint recverrok = 0; /* ok to proceed after socket receive errors */
3d96ee83babeec32482c9082c9426340cee8c44dwroweenum {NO_METH = 0, GET, HEAD, PUT, POST} method = NO_METH;
a19698aebe10b9d41574e4a73794ba7d4cecd78btrawickconst char *method_str[] = {"bug", "GET", "HEAD", "PUT", "POST"};
a19698aebe10b9d41574e4a73794ba7d4cecd78btrawickint send_body = 0; /* non-zero if sending body with request */
3d96ee83babeec32482c9082c9426340cee8c44dwroweint heartbeatres = 100; /* How often do we say we're alive */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint concurrency = 1; /* Number of multiple requests to make */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint confidence = 1; /* Show confidence estimator and warnings */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint keepalive = 0; /* try and do keepalive connections */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint windowsize = 0; /* we use the OS default window size */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarconst char *host_field; /* value of "Host:" header field */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarchar postfile[1024]; /* name of file containing post data */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarchar *postdata; /* *buffer containing data from postfile */
3d96ee83babeec32482c9082c9426340cee8c44dwroweapr_size_t postlen = 0; /* length of data to be POSTed */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarchar content_type[1024];/* content type to put in POST header */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarconst char *fullurl;
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarapr_interval_time_t aprtimeout = apr_time_from_sec(30); /* timeout value */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar/* overrides for ab-generated common headers */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint opt_host = 0; /* was an optional "Host:" header specified? */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarint opt_useragent = 0; /* was an optional "User-Agent:" header specified? */
3d96ee83babeec32482c9082c9426340cee8c44dwroweint opt_accept = 0; /* was an optional "Accept:" header specified? */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar * XXX - this is now a per read/write transact type of value
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarconst char *trstring;
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarconst char *tdstring;
3d96ee83babeec32482c9082c9426340cee8c44dwroweapr_size_t doclen = 0; /* the length the document should be */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarapr_int64_t totalread = 0; /* total number of bytes read */
2d2eda71267231c2526be701fe655db125852c1ffieldingapr_int64_t totalbread = 0; /* totoal amount of entity body read */
2d2eda71267231c2526be701fe655db125852c1ffieldingapr_int64_t totalposted = 0; /* total number of bytes posted, inc. headers */
2d2eda71267231c2526be701fe655db125852c1ffieldingint started = 0; /* number of requests started, so no excess */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint doneka = 0; /* number of keep alive connections done */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint good = 0, bad = 0; /* number of good and bad requests */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint err_length = 0; /* requests failed due to response length */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint err_conn = 0; /* requests failed due to connection drop */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint err_recv = 0; /* requests failed due to broken read */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint err_except = 0; /* requests failed due to exception */
3d96ee83babeec32482c9082c9426340cee8c44dwroweint err_response = 0; /* requests with invalid or non-200 response */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* global request (and its length) */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* one global throw-away buffer to read stuff into */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein/* interesting percentiles */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe/* --------------------------------------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* simple little function to write an error string and exit */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbstatic void err(const char *s)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* simple little function to write an APR error string and exit */
2d2eda71267231c2526be701fe655db125852c1ffielding "%s: %s (%d)\n",
2d2eda71267231c2526be701fe655db125852c1ffieldingstatic void set_polled_events(struct connection *c, apr_int16_t new_reqevents)
61fd0cab072a05b855cbef9c585702401ac5ae29rbbstatic void set_conn_state(struct connection *c, connect_state_e new_state)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb 0, /* for STATE_UNCONNECTED */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe APR_POLLIN, /* for STATE_CONNECTED; we don't poll in this state,
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein * so prepare for polling in the following state --
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * STATE_READ
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein/* --------------------------------------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* write out request to a connection - assumes we can write
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * (small) request out in one go into our new socket buffer
61fd0cab072a05b855cbef9c585702401ac5ae29rbbstatic long ssl_print_cb(BIO *bio,int cmd,const char *argp,int argi,long argl,long ret)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb BIO_printf(out,"read from %p [%p] (%d bytes => %ld (0x%lX))\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb BIO_printf(out,"write to %p [%p] (%d bytes => %ld (0x%lX))\n",
3d96ee83babeec32482c9082c9426340cee8c44dwrowe } else if (w & SSL_CB_LOOP) {
61fd0cab072a05b855cbef9c585702401ac5ae29rbb } else if (w & (SSL_CB_HANDSHAKE_START|SSL_CB_HANDSHAKE_DONE)) {
61fd0cab072a05b855cbef9c585702401ac5ae29rbbstatic int ssl_rand_choosenum(int l, int h)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb if (i < l) i = l;
61fd0cab072a05b855cbef9c585702401ac5ae29rbb if (i > h) i = h;
61fd0cab072a05b855cbef9c585702401ac5ae29rbbstatic void ssl_rand_seed(void)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * seed in the current time (usually just 4 bytes)
346029f34d03eb20d84fc35664426d3874b00f9ewrowe l = sizeof(time_t);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb RAND_seed((unsigned char *)&t, l);
3d96ee83babeec32482c9082c9426340cee8c44dwrowe * seed in the current process id (usually just 4 bytes)
fd8b91502bc200ed4cca3810560a2a570522b3debrianp l = sizeof(pid_t);
fd8b91502bc200ed4cca3810560a2a570522b3debrianp * seed in some current state of the run-time stack (128 bytes)
fd8b91502bc200ed4cca3810560a2a570522b3debrianpstatic int ssl_print_connection_info(BIO *bio, SSL *ssl)
fd8b91502bc200ed4cca3810560a2a570522b3debrianp BIO_printf(bio,"Cipher Suite Protocol :%s\n", SSL_CIPHER_get_version(c));
fd8b91502bc200ed4cca3810560a2a570522b3debrianp BIO_printf(bio,"Cipher Suite Name :%s\n",SSL_CIPHER_get_name(c));
fd8b91502bc200ed4cca3810560a2a570522b3debrianp BIO_printf(bio,"Cipher Suite Cipher Bits:%d (%d)\n",bits,alg_bits);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb BIO_printf(bio, "Certificate version: %ld\n", X509_get_version(cert)+1);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* dump the extension list too */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb BIO_printf(bio, "Extension Count: %d\n", X509_get_ext_count(cert));
dad234382d8424e1c5a30af2838e172aec9d6d1bdreidstatic void ssl_proceed_handshake(struct connection *c)
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb switch (ecode) {
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb /* Try again */
c9a95767fbf0f5fb0976a06b97a256033925e433rbb /* Unexpected result */
c9a95767fbf0f5fb0976a06b97a256033925e433rbb BIO_printf(bio_err, "SSL handshake failed (%d).\n", ecode);
c9a95767fbf0f5fb0976a06b97a256033925e433rbb#endif /* USE_SSL */
if (c->rwrite == 0) {
c->rwrote = 0;
if (send_body)
close_connection(c);
#ifdef USE_SSL
if (c->ssl) {
if (e_ssl != l) {
close_connection (c);
l = e_ssl;
e = APR_SUCCESS;
epipe++;
close_connection(c);
totalposted += l;
c->rwrote += l;
c->rwrite -= l;
} while (c->rwrite);
started++;
double timetaken;
if (sig) {
#ifdef USE_SSL
if (bad)
if (err_response)
if (keepalive)
if (send_body)
if (send_body) {
if (done > 0) {
for (i = 0; i < done; i++) {
for (i = 0; i < done; i++) {
sdtot += a * a;
sdcon += a * a;
sdd += a * a;
sdwait += a * a;
(int (*) (const void *, const void *)) compradre);
(int (*) (const void *, const void *)) compri);
(int (*) (const void *, const void *)) compwait);
(int (*) (const void *, const void *)) comprando);
if (confidence) {
#define CONF_FMT_STRING "%5" APR_TIME_T_FMT " %4" APR_TIME_T_FMT " %5.1f %6" APR_TIME_T_FMT " %7" APR_TIME_T_FMT "\n"
else if (d > sd ) \
for (i = 0; i < sizeof(percs) / sizeof(int); i++) {
if (percs[i] <= 0)
if (csvperc) {
if (!out) {
if (gnuplot) {
if (!out) {
for (i = 0; i < done; i++) {
if (sig) {
static void output_html_results(void)
if (bad)
if (err_response)
if (keepalive)
if (send_body)
if (timetaken) {
if (send_body) {
for (i = 0; i < done; i++) {
c->read = 0;
c->bread = 0;
c->keepalive = 0;
c->cbx = 0;
c->gotheader = 0;
c->rwrite = 0;
if (c->ctx)
!= APR_SUCCESS) {
if (windowsize != 0) {
#ifdef USE_SSL
if (is_ssl) {
c->rwrite = 0;
err_conn++;
start_connect(c);
#ifdef USE_SSL
if (c->ssl) {
write_request(c);
if (good)
bad++;
err_length++;
#ifdef USE_SSL
if (c->ssl) {
start_connect(c);
apr_size_t r;
char *part;
r = sizeof(buffer);
#ifdef USE_SSL
if (c->ssl) {
if (status <= 0) {
good++;
close_connection(c);
c->read = 0;
close_connection(c);
r = status;
good++;
close_connection(c);
err_recv++;
if (recverrok) {
bad++;
close_connection(c);
totalread += r;
if (c->read == 0) {
c->read += r;
if (!c->gotheader) {
#ifdef NOT_ASCII
if (space) {
err_response++;
start_connect(c);
if (!good) {
q = servername;
err_response++;
if (keepalive &&
char *cl;
if (!cl)
if (cl) {
if (!cl) {
c->length = 0;
c->bread += r;
totalbread += r;
good++;
bad++;
err_length++;
doneka++;
c->keepalive = 0;
c->length = 0;
c->gotheader = 0;
c->cbx = 0;
write_request(c);
static void test(void)
int snprintf_res = 0;
#ifdef NOT_ASCII
if (isproxy) {
if (!use_html) {
if (isproxy)
if (!opt_host) {
if (!opt_useragent) {
if (!opt_accept) {
if (!send_body) {
if (send_body) {
if (!buff) {
#ifdef NOT_ASCII
!= APR_SUCCESS) {
#ifdef SIGINT
for (i = 0; i < concurrency; i++) {
apr_int32_t n;
n = concurrency;
struct connection *c;
#ifdef USE_SSL
read_connection(c);
bad++;
err_except++;
/* avoid apr_poll/EINPROGRESS loop on HP-UX, let recv discover ECONNREFUSED */
read_connection(c);
start_connect(c);
err_conn++;
start_connect(c);
#ifdef USE_SSL
if (c->ssl)
write_request(c);
write_request(c);
if (heartbeatres)
if (use_html)
output_results(0);
static void copyright(void)
if (!use_html) {
printf(" This is ApacheBench, Version %s <i><%s></i><br>\n", AP_AB_BASEREVISION, "$Revision$");
#ifdef USE_SSL
/* 80 column ruler: ********************************************************************************
#ifdef USE_SSL
char *cp;
char *scope_id;
#ifdef USE_SSL
is_ssl = 0;
#ifdef USE_SSL
#ifdef USE_SSL
if (is_ssl)
#ifdef USE_SSL
return rv;
return rv;
if (!postdata) {
return APR_ENOMEM;
return rv;
return APR_SUCCESS;
const char *optarg;
#ifdef USE_SSL
#ifdef NOT_ASCII
if (status) {
if (status) {
if (status) {
#ifdef USE_SSL
if (requests <= 0) {
heartbeatres = 0;
percentile = 0;
confidence = 0;
optarg++;
optarg++;
copyright();
#ifdef USE_SSL
heartbeatres = 0;
#ifdef USE_SSL
#ifdef RSAREF
#ifdef SIGPIPE
copyright();
test();