diff --minimal --new-file --recursive --show-c-function --unified=3 apache_1.3.12.old/src/support/ab.c apache_1.3.12/src/support/ab.c
--- apache_1.3.12.old/src/support/ab.c	Sat Feb  5 03:50:54 2000
+++ apache_1.3.12/src/support/ab.c	Sun Apr 16 09:53:02 2000
@@ -97,7 +97,7 @@
  *   only an issue for loopback usage
  */
 
-#define VERSION "1.3c"
+#define VERSION "1.3c-deb"
 
 /*  -------------------------------------------------------------------- */
 
@@ -164,6 +164,12 @@ struct connection {
     struct timeval start, connect, done;
 };
 
+struct server {
+	struct sockaddr_in address;
+	int doclen;
+	int good, bad;
+};
+
 struct data {
     int read;			/* number of bytes read */
     int ctime;			/* time in ms to connect */
@@ -195,6 +201,7 @@ char cookie[1024],		/* optional cookie l
 int port = 80;			/* port number */
 
 int use_html = 0;		/* use html in the report */
+int num_hosts = 0;		/* Number of hosts in round-robin dns */
 char *tablestring;
 char *trstring;
 char *tdstring;
@@ -206,6 +213,7 @@ int totalposted = 0;		/* total number of
 int done = 0;			/* number of requests we have done */
 int doneka = 0;			/* number of keep alive connections done */
 int good = 0, bad = 0;		/* number of good and bad requests */
+int round_robin = 0;		/* Enable round_robin support */
 
 /* store error cases */
 int err_length = 0, err_conn = 0, err_except = 0;
@@ -224,7 +232,7 @@ struct connection *con;		/* connection a
 struct data *stats;		/* date for each request */
 
 fd_set readbits, writebits;	/* bits for select */
-struct sockaddr_in server;	/* server addr structure */
+struct server **server = NULL;	/* server addr structure */
 
 #ifndef BEOS
 #define ab_close(s) close(s)
@@ -329,6 +337,8 @@ static void output_results(void)
     printf("\r                                                                           \r");
     printf("Server Software:        %s\n", servername);
     printf("Server Hostname:        %s\n", hostname);
+    if (num_hosts > 1)
+	printf("Number of Hosts:        %i\n", num_hosts);
     printf("Server Port:            %d\n", port);
     printf("\n");
     printf("Document Path:          %s\n", path);
@@ -410,6 +420,10 @@ static void output_html_results(void)
     printf("<tr %s><th colspan=2 %s>Server Hostname:</th>"
 	   "<td colspan=2 %s>%s</td></tr>\n",
 	   trstring, tdstring, tdstring, hostname);
+    if (num_hosts > 1)
+	printf("<tr %s><th colspan=2 %s>Server Hostname:</th>"
+		"<td colspan=2 %s>%i</td></tr>\n",
+		trstring, tdstring, tdstring, num_hosts);
     printf("<tr %s><th colspan=2 %s>Server Port:</th>"
 	   "<td colspan=2 %s>%d</td></tr>\n",
 	   trstring, tdstring, tdstring, port);
@@ -522,6 +536,13 @@ static void output_html_results(void)
 
 static void start_connect(struct connection * c)
 {
+    static int current_server = 0;
+    struct sockaddr my_server;
+
+    memcpy(&my_server, server[current_server], sizeof(struct sockaddr));
+    current_server++;
+    if(current_server >= num_hosts)
+	current_server = 0;
     c->read = 0;
     c->bread = 0;
     c->keepalive = 0;
@@ -535,7 +556,7 @@ static void start_connect(struct connect
     nonblock(c->fd);
     gettimeofday(&c->start, 0);
 
-    if (connect(c->fd, (struct sockaddr *) & server, sizeof(server)) < 0) {
+    while(connect(c->fd, &my_server, sizeof(struct sockaddr)) < 0) {
 	if (errno == EINPROGRESS) {
 	    c->state = STATE_CONNECTING;
 	    FD_SET(c->fd, &writebits);
@@ -544,10 +565,16 @@ static void start_connect(struct connect
 	else {
 	    ab_close(c->fd);
 	    err_conn++;
+	    c->fd = socket(AF_INET, SOCK_STREAM, 0);
+	    if (c->fd < 0)
+		err("socket");
+
+	    nonblock(c->fd);
+	    gettimeofday(&c->start, 0);
+
 	    if (bad++ > 10) {
 		err("\nTest aborted after 10 failures\n\n");
 	    }
-	    start_connect(c);
 	}
     }
 
@@ -770,13 +797,24 @@ static void test(void)
 
     {
 	/* get server information */
+	int counter;
 	struct hostent *he;
 	he = gethostbyname(hostname);
 	if (!he)
 	    err("bad hostname");
-	server.sin_family = he->h_addrtype;
-	server.sin_port = htons(port);
-	server.sin_addr.s_addr = ((unsigned long *) (he->h_addr_list[0]))[0];
+	if(round_robin) {
+	    for(num_hosts = 0; he->h_addr_list[num_hosts]; num_hosts++);
+	} else
+	    num_hosts = 1;
+	server = malloc(sizeof(struct server *) * num_hosts);
+	for(counter = 0; counter < num_hosts; counter++) {
+	    server[counter] = malloc(sizeof(struct server));
+	    server[counter]->address.sin_family = he->h_addrtype;
+	    server[counter]->address.sin_port = htons(port);
+	    server[counter]->address.sin_addr.s_addr = ((unsigned long *) (he->h_addr_list[counter]))[0];
+	    server[counter]->good = 0;
+	    server[counter]->bad = 0;
+	}
     }
 
     con = malloc(concurrency * sizeof(struct connection));
@@ -905,6 +943,7 @@ static void usage(char *progname)
     fprintf(stderr, "Options are:\n");
     fprintf(stderr, "    -n requests     Number of requests to perform\n");
     fprintf(stderr, "    -c concurrency  Number of multiple requests to make\n");
+    fprintf(stderr, "    -r              Enable round-robin dns support\n");
     fprintf(stderr, "    -t timelimit    Seconds to max. wait for responses\n");
     fprintf(stderr, "    -p postfile     File containg data to POST\n");
     fprintf(stderr, "    -T content-type Content-type header for POSTing\n");
@@ -1004,7 +1043,7 @@ int main(int argc, char **argv)
     auth[0] = '\0';
     hdrs[0] = '\0';
     optind = 1;
-    while ((c = getopt(argc, argv, "n:c:t:T:p:v:kVhwix:y:z:C:H:P:A:")) > 0) {
+    while ((c = getopt(argc, argv, "n:c:t:T:p:v:rkVhwix:y:z:C:H:P:A:")) > 0) {
 	switch (c) {
 	case 'n':
 	    requests = atoi(optarg);
@@ -1084,6 +1123,9 @@ int main(int argc, char **argv)
 	case 'V':
 	    copyright();
 	    exit(0);
+	    break;
+	case 'r':
+	    round_robin = 1;
 	    break;
 	case 'w':
 	    use_html = 1;
