ab.c revision c9c04228fc004c5ab2e739100f9d95804c28d23d
2d2eda71267231c2526be701fe655db125852c1ffielding/* ====================================================================
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * The Apache Software License, Version 1.1
bc8fd1b0b1afdf89b8d28eefa8cd74e26ba97986fielding * Copyright (c) 2000 The Apache Software Foundation. All rights
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * reserved.
2d2eda71267231c2526be701fe655db125852c1ffielding * Redistribution and use in source and binary forms, with or without
2d2eda71267231c2526be701fe655db125852c1ffielding * modification, are permitted provided that the following conditions
2d2eda71267231c2526be701fe655db125852c1ffielding * 1. Redistributions of source code must retain the above copyright
2d2eda71267231c2526be701fe655db125852c1ffielding * notice, this list of conditions and the following disclaimer.
2d2eda71267231c2526be701fe655db125852c1ffielding * 2. Redistributions in binary form must reproduce the above copyright
2d2eda71267231c2526be701fe655db125852c1ffielding * notice, this list of conditions and the following disclaimer in
2d2eda71267231c2526be701fe655db125852c1ffielding * the documentation and/or other materials provided with the
2d2eda71267231c2526be701fe655db125852c1ffielding * distribution.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * 3. The end-user documentation included with the redistribution,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * if any, must include the following acknowledgment:
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * "This product includes software developed by the
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * Apache Software Foundation (http://www.apache.org/)."
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * Alternately, this acknowledgment may appear in the software itself,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * if and wherever such third-party acknowledgments normally appear.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * 4. The names "Apache" and "Apache Software Foundation" must
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * not be used to endorse or promote products derived from this
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * software without prior written permission. For written
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * permission, please contact apache@apache.org.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * 5. Products derived from this software may not be called "Apache",
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * nor may "Apache" appear in their name, without prior written
64185f9824e42f21ca7b9ae6c004484215c031a7rbb * permission of the Apache Software Foundation.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
2d2eda71267231c2526be701fe655db125852c1ffielding * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * SUCH DAMAGE.
2d2eda71267231c2526be701fe655db125852c1ffielding * ====================================================================
2d2eda71267231c2526be701fe655db125852c1ffielding * This software consists of voluntary contributions made by many
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * individuals on behalf of the Apache Software Foundation. For more
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * information on the Apache Software Foundation, please see
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * Portions of this software are based upon public domain software
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * originally written at the National Center for Supercomputing Applications,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * University of Illinois, Urbana-Champaign.
2d2eda71267231c2526be701fe655db125852c1ffielding ** This program is based on ZeusBench V1.0 written by Adam Twiss
2d2eda71267231c2526be701fe655db125852c1ffielding ** which is Copyright (c) 1996 by Zeus Technology Ltd. http://www.zeustech.net/
b980ad7fdc218b4855cde9f75a747527f50c554dwrowe ** This software is provided "as is" and any express or implied waranties,
ab5581cc78e9d865b0a6ab1404c53347b3276968rbb ** including but not limited to, the implied warranties of merchantability and
92f3af936ce61f25358a3ee4f28df2f6d62040dfdreid ** fitness for a particular purpose are disclaimed. In no event shall
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** Zeus Technology Ltd. be liable for any direct, indirect, incidental, special,
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** exemplary, or consequential damaged (including, but not limited to,
fd0edaa8e3d4dd67d0604ccef2e96b071db96643fielding ** procurement of substitute good or services; loss of use, data, or profits;
2d2eda71267231c2526be701fe655db125852c1ffielding ** or business interruption) however caused and on theory of liability. Whether
2d2eda71267231c2526be701fe655db125852c1ffielding ** in contract, strict liability or tort (including negligence or otherwise)
2d2eda71267231c2526be701fe655db125852c1ffielding ** arising in any way out of the use of this software, even if advised of the
2d2eda71267231c2526be701fe655db125852c1ffielding ** possibility of such damage.
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** HISTORY:
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** - Originally written by Adam Twiss <adam@zeus.co.uk>, March 1996
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** with input from Mike Belshe <mbelshe@netscape.com> and
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** Michael Campanella <campanella@stevms.enet.dec.com>
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb ** - Enhanced by Dean Gaudet <dgaudet@apache.org>, November 1997
2d2eda71267231c2526be701fe655db125852c1ffielding ** - Cleaned up by Ralf S. Engelschall <rse@apache.org>, March 1998
2d2eda71267231c2526be701fe655db125852c1ffielding ** - POST and verbosity by Kurt Sussman <kls@merlot.com>, August 1998
2d2eda71267231c2526be701fe655db125852c1ffielding ** - HTML table output added by David N. Welton <davidw@prosa.it>, January 1999
2d2eda71267231c2526be701fe655db125852c1ffielding ** - Added Cookie, Arbitrary header and auth support. <dirkx@webweaving.org>, April 1999
2d2eda71267231c2526be701fe655db125852c1ffielding * - has various other poor buffer attacks related to the lazy parsing of
8af88bd6958b80c224e964892b8237720b13ab1ajerenkrantz * response headers from the server
8af88bd6958b80c224e964892b8237720b13ab1ajerenkrantz * - doesn't implement much of HTTP/1.x, only accepts certain forms of
8af88bd6958b80c224e964892b8237720b13ab1ajerenkrantz * - (performance problem) heavy use of strstr shows up top in profile
8af88bd6958b80c224e964892b8237720b13ab1ajerenkrantz * only an issue for loopback usage
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* -------------------------------------------------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* Hmmm... This source code isn't being compiled in ASCII.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * In order for data that flows over the network to make
3d96ee83babeec32482c9082c9426340cee8c44dwrowe * sense, we need to translate to/from ASCII.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* affects include files on Solaris */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* ------------------- DEFINITIONS -------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* maximum number of requests on a time limited test */
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein/* good old state hostname */
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp int length; /* Content-Length value used for keep-alive */
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp char cbuff[CBUFFSIZE]; /* a buffer to store server response header */
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp int keepalive; /* non-zero if a keep-alive request */
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp int gotheader; /* non-zero if we have the entire header in
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define ap_min(a,b) ((a)<(b))?(a):(b)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define ap_max(a,b) ((a)>(b))?(a):(b)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------- GLOBALS ---------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint concurrency = 1; /* Number of multiple requests to make */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint keepalive = 0; /* try and do keepalive connections */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbchar postfile[1024]; /* name of file containing post data */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbchar *postdata; /* *buffer containing data from postfile */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbapr_size_t postlen = 0; /* length of data to be POSTed */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbchar content_type[1024]; /* content type to put in POST header */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * authentification */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbapr_time_t aprtimeout = 30 * APR_USEC_PER_SEC; /* timeout value */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbconst char *trstring;
2d2eda71267231c2526be701fe655db125852c1ffieldingint doclen = 0; /* the length the document should be */
2d2eda71267231c2526be701fe655db125852c1ffieldingint totalbread = 0; /* totoal amount of entity body read */
2d2eda71267231c2526be701fe655db125852c1ffieldingint totalposted = 0; /* total number of bytes posted, inc. headers */
2d2eda71267231c2526be701fe655db125852c1ffieldingint doneka = 0; /* number of keep alive connections done */
2d2eda71267231c2526be701fe655db125852c1ffieldingint started = 0; /* number of requests started, so no excess */
2d2eda71267231c2526be701fe655db125852c1ffieldingint good = 0, bad = 0; /* number of good and bad requests */
2d2eda71267231c2526be701fe655db125852c1ffielding/* store error cases */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* global request (and its length) */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* one global throw-away buffer to read stuff into */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------------------------------------------- */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe/* simple little function to write an error string and exit */
23ff73a56371e21f16744cb94d06399b877829f1rbbstatic void err(char *s)
62db15de4c1f335a64d45821796ae197cff94ef8rbb/* simple little function to write an APR error string and exit */
62db15de4c1f335a64d45821796ae197cff94ef8rbb "%s: %s (%d)\n",
62db15de4c1f335a64d45821796ae197cff94ef8rbb/* --------------------------------------------------------- */
62db15de4c1f335a64d45821796ae197cff94ef8rbb/* write out request to a connection - assumes we can write
62db15de4c1f335a64d45821796ae197cff94ef8rbb (small) request out in one go into our new socket buffer */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout);
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar if (apr_send(c->aprsock, request, &reqlen) != APR_SUCCESS ||
3d96ee83babeec32482c9082c9426340cee8c44dwrowe apr_add_poll_socket(readbits, c->aprsock, APR_POLLIN);
a19698aebe10b9d41574e4a73794ba7d4cecd78btrawick/* --------------------------------------------------------- */
a19698aebe10b9d41574e4a73794ba7d4cecd78btrawick/* calculate and output results */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coarstatic void output_results(void)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar /* avoid divide by zero */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar printf("Requests per second: %.2f\n", 1000 * (float) (done) / timetaken);
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard /* work out connection times */
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard for (i = 0; i < requests; i++) {
61fd0cab072a05b855cbef9c585702401ac5ae29rbb if (requests > 0) { /* avoid division by zero (if 0 requests) */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("Connect: %5d %5d %5d\n", mincon, totalcon / requests, maxcon);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb mintot - mincon, (total / requests) - (totalcon / requests),
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein printf("Total: %5d %5d %5d\n", mintot, total / requests, maxtot);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------------------------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* calculate and output results in HTML */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgsteinstatic void output_html_results(void)
3d96ee83babeec32482c9082c9426340cee8c44dwrowe "<td colspan=2 %s>%s</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%s</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%hd</td></tr>\n",
3d96ee83babeec32482c9082c9426340cee8c44dwrowe "<td colspan=2 %s>%s</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d bytes</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("<tr %s><th colspan=2 %s>Concurrency Level:</th>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("<tr %s><th colspan=2 %s>Time taken for tests:</th>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d.%03d seconds</td></tr>\n",
3d96ee83babeec32482c9082c9426340cee8c44dwrowe trstring, tdstring, tdstring, timetaken / 1000, timetaken % 1000);
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein printf("<tr %s><th colspan=2 %s>Complete requests:</th>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("<tr %s><td colspan=4 %s > (Connect: %d, Length: %d, Exceptions: %d)</td></tr>\n",
2d2eda71267231c2526be701fe655db125852c1ffielding printf("<tr %s><th colspan=2 %s>Non-2xx responses:</th>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("<tr %s><th colspan=2 %s>Keep-Alive requests:</th>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d</td></tr>\n",
3d96ee83babeec32482c9082c9426340cee8c44dwrowe printf("<tr %s><th colspan=2 %s>Total transferred:</th>"
2d2eda71267231c2526be701fe655db125852c1ffielding "<td colspan=2 %s>%d bytes</td></tr>\n",
2d2eda71267231c2526be701fe655db125852c1ffielding printf("<tr %s><th colspan=2 %s>Total POSTed:</th>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%d</td></tr>\n",
2d2eda71267231c2526be701fe655db125852c1ffielding "<td colspan=2 %s>%d bytes</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* avoid divide by zero */
d839a9822ee53ce00da24c15f2d9fe054233d342gstein printf("<tr %s><th colspan=2 %s>Requests per second:</th>"
d839a9822ee53ce00da24c15f2d9fe054233d342gstein "<td colspan=2 %s>%.2f</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb trstring, tdstring, tdstring, 1000 * (float) (done) / timetaken);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%.2f kb/s received</td></tr>\n",
d839a9822ee53ce00da24c15f2d9fe054233d342gstein trstring, tdstring, tdstring, (float) (totalread) / timetaken);
2d2eda71267231c2526be701fe655db125852c1ffielding "<td colspan=2 %s>%.2f kb/s sent</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td colspan=2 %s>%.2f kb/s total</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* work out connection times */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb for (i = 0; i < requests; i++) {
61fd0cab072a05b855cbef9c585702401ac5ae29rbb if (requests > 0) { /* avoid division by zero (if 0 requests) */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("<tr %s><th %s colspan=4>Connnection Times (ms)</th></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb printf("<tr %s><th %s> </th> <th %s>min</th> <th %s>avg</th> <th %s>max</th></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td>"
11a7b0dff22d26770b532c174d1cf2e7b56ec244wrowe "<td %s>%5d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb trstring, tdstring, tdstring, mincon, tdstring, totalcon / requests, tdstring, maxcon);
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein "<td %s>%5d</td>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb trstring, tdstring, tdstring, mintot - mincon, tdstring,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb (total / requests) - (totalcon / requests), tdstring, maxtot - maxcon);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "<td %s>%5d</td></tr>\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb trstring, tdstring, tdstring, mintot, tdstring, total / requests, tdstring, maxtot);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------------------------------------------- */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* start asnchronous non-blocking connection */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein if ((rv = apr_getaddrinfo(&destsa, hostname, APR_UNSPEC, port, 0, cntxt))
3d96ee83babeec32482c9082c9426340cee8c44dwrowe if ((rv = apr_create_socket(&c->aprsock, destsa->sa.sin.sin_family,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb if ((rv = apr_connect(c->aprsock, destsa)) != APR_SUCCESS) {
61fd0cab072a05b855cbef9c585702401ac5ae29rbb "\nTest aborted after 10 failures\n\n");
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* connected first time */
fd8b91502bc200ed4cca3810560a2a570522b3debrianp/* --------------------------------------------------------- */
fd8b91502bc200ed4cca3810560a2a570522b3debrianp/* close down connection and save stats */
fd8b91502bc200ed4cca3810560a2a570522b3debrianp /* server has legitimately shut down an idle keep alive request */
fd8b91502bc200ed4cca3810560a2a570522b3debrianp /* first time here */
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames /* save out time */
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames /* connect again */
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames/* --------------------------------------------------------- */
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames/* read data from connection */
2d2eda71267231c2526be701fe655db125852c1ffielding r = sizeof(buffer);
3d96ee83babeec32482c9082c9426340cee8c44dwrowe apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout);
344f3bc38dfccf6261d5bb8d689794cde113b3d6coar if (r == 0 || (status != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(status))) {
61fd0cab072a05b855cbef9c585702401ac5ae29rbb int space = CBUFFSIZE - c->cbx - 1; /* -1 to allow for 0 terminator */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb status = apr_xlate_conv_buffer(from_ascii, buffer, &inbytes_left,
42ce672c516baf6e4eaed18ccc1647de2d456d8edougm fprintf(stderr, "only simple translation is supported (%d/%u/%u)\n",
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#endif /*NOT_ASCII */
42ce672c516baf6e4eaed18ccc1647de2d456d8edougm c->cbuff[c->cbx] = 0; /* terminate for benefit of strstr */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* this next line is so that we talk to NCSA 1.5 which blatantly
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * breaks the http specifaction
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* read rest next time */
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb /* header is in invalid or too big - close connection */
8b7047e519340545e6807c9749576a40a76b6d3frbb /* have full header */
6d00a43be9ab145c89e8cc22bad59e3aa746f761jwoolley /* this is first time, extract some interesting info */
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb char *p, *q;
2e75499d05677dd589f7ce6b5139ae15ba049419jerenkrantz while (*p > 32)
2e75499d05677dd589f7ce6b5139ae15ba049419jerenkrantz *q++ = *p++;
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb /* XXX: this parsing isn't even remotely HTTP compliant...
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb * but in the interest of speed it doesn't totally have to be,
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb * it just needs to be extended to handle whatever servers
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb * folks want to test against. -djg */
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb /* check response code */
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb printf("WARNING: Response code not 2xx (%s)\n", respcode);
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley *s = 0; /* terminate at end of header */
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley || strstr(c->cbuff, "keep-alive"))) { /* for benefit of MSIIS */
c9a95767fbf0f5fb0976a06b97a256033925e433rbb /* handle NCSA, which sends Content-length: */
2d2eda71267231c2526be701fe655db125852c1ffielding /* outside header, everything we have read is entity body */
good++;
doneka++;
bad++;
err_length++;
struct data s;
c->keepalive = 0;
c->length = 0;
c->gotheader = 0;
c->cbx = 0;
write_request(c);
static void test(void)
#ifdef NOT_ASCII
if (!use_html) {
if (!posting) {
path,
path,
#ifdef NOT_ASCII
for (i = 0; i < concurrency; i++) {
apr_int32_t n;
n = concurrency;
for (i = 0; i < concurrency; i++) {
bad++;
err_except++;
if (use_html)
static void copyright(void)
if (!use_html) {
printf(" This is ApacheBench, Version %s <i><%s></i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.50 $");
char *cp;
char *scope_id;
return rv;
if (!postdata) {
return APR_ENOMEM;
return rv;
length);
return APR_EINVAL;
const char *optarg;
#ifdef NOT_ASCII
if (status) {
if (status) {
if (status) {
if (!requests) {
if (posting != 0)
else if (postdata) {
exit(r);
optarg++;
optarg++;
copyright();
copyright();
test();