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