]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
merge some ab fixes from 2.1-dev
authorJeff Trawick <trawick@apache.org>
Sun, 14 Dec 2003 00:50:20 +0000 (00:50 +0000)
committerJeff Trawick <trawick@apache.org>
Sun, 14 Dec 2003 00:50:20 +0000 (00:50 +0000)
Submitted by: trawick
Reviewed by: brianp, ianh

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102051 13f79535-47bb-0310-9956-ffa450edef68

STATUS
support/ab.c

diff --git a/STATUS b/STATUS
index 6f797e468d3895849acbedccbd75845a8b624cdc..509e6609d88341618deb5eb0d2a0e3419ed38cf6 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2003/12/14 00:26:12 $]
+Last modified at [$Date: 2003/12/14 00:50:20 $]
 
 Release:
 
@@ -209,12 +209,6 @@ PATCHES TO BACKPORT FROM 2.1
               Yes, I think, a useful error message is better than
               a coredump in this case.
 
-    * More ab fixes; r1.129 fixes what looks like a trivial error in the 
-      SSL support; r1.130 adds some state-handling fixes related to
-      ab's breakage in 2.0.47
-        support/ab.c: r1.129, r1.130
-      +1: trawick, brianp, ianh
-
     * mod_rewrite: more or less cosmetic fix. If a .htaccess in DocumentRoot
       configures:
         RewriteBase /
index 90b129a4196c0e41ab3aea19777c1b20c1f398bd..b559201f3ff0dc2e0b6d4822e632f5a5c592b715 100644 (file)
 
 /* good old state hostname */
 #define STATE_UNCONNECTED 0
-#define STATE_CONNECTING  1
-#define STATE_READ        2
+#define STATE_CONNECTING  1     /* TCP connect initiated, but we don't
+                                 * know if it worked yet
+                                 */
+#define STATE_CONNECTED   2     /* we know TCP connect completed */
+#define STATE_READ        3
 
 #define CBUFFSIZE (2048)
 
@@ -668,7 +671,7 @@ void ssl_start_connect(struct connection * c)
             case SSL_ERROR_WANT_CONNECT:
                 BIO_printf(bio_err, "Waiting .. sleep(1)\n");
                 apr_sleep(apr_time_from_sec(1));
-                c->state = STATE_CONNECTING;
+                c->state = STATE_CONNECTED;
                 c->rwrite = 0;
                 break;
             case SSL_ERROR_ZERO_RETURN:
@@ -770,6 +773,7 @@ static void write_request(struct connection * c)
 
 #ifdef USE_SSL
         if (ssl != 1)
+#endif
        if (e != APR_SUCCESS) {
            /*
             * Let's hope this traps EWOULDBLOCK too !
@@ -781,7 +785,6 @@ static void write_request(struct connection * c)
            }
            return;
        }
-#endif
        c->rwrote += l;
        c->rwrite -= l;
     } while (1);
@@ -1256,7 +1259,7 @@ static void start_connect(struct connection * c)
            c->state = STATE_CONNECTING;
            c->rwrite = 0;
             new_pollfd.desc_type = APR_POLL_SOCKET;
-            new_pollfd.reqevents = APR_POLLOUT | APR_POLLIN;
+            new_pollfd.reqevents = APR_POLLOUT;
             new_pollfd.desc.s = c->aprsock;
             new_pollfd.client_data = c;
            apr_pollset_add(readbits, &new_pollfd);
@@ -1281,6 +1284,7 @@ static void start_connect(struct connection * c)
     }
 
     /* connected first time */
+    c->state = STATE_CONNECTED;
     started++;
     write_request(c);
 }
@@ -1735,8 +1739,34 @@ static void test(void)
                start_connect(c);
                continue;
            }
-           if (rv & APR_POLLOUT)
-               write_request(c);
+           if (rv & APR_POLLOUT) {
+                if (c->state == STATE_CONNECTING) {
+                    apr_pollfd_t remove_pollfd;
+                    rv = apr_connect(c->aprsock, destsa);
+                    remove_pollfd.desc_type = APR_POLL_SOCKET;
+                    remove_pollfd.desc.s = c->aprsock;
+                    apr_pollset_remove(readbits, &remove_pollfd);
+                    if (rv != APR_SUCCESS) {
+                        apr_socket_close(c->aprsock);
+                        err_conn++;
+                        if (bad++ > 10) {
+                            fprintf(stderr,
+                                    "\nTest aborted after 10 failures\n\n");
+                            apr_err("apr_connect()", rv);
+                        }
+                        c->state = STATE_UNCONNECTED;
+                        start_connect(c);
+                        continue;
+                    }
+                    else {
+                        c->state = STATE_CONNECTED;
+                        write_request(c);
+                    }
+                }
+                else {
+                    write_request(c);
+                }
+            }
 
            /*
             * When using a select based poll every time we check the bits
@@ -1748,8 +1778,7 @@ static void test(void)
 #ifdef USE_SSL
             if (ssl != 1)
 #endif
-           if (c->state == STATE_READ ||
-                c->state == STATE_CONNECTING) {
+                if (c->state == STATE_READ) {
                     apr_pollfd_t new_pollfd;
                     new_pollfd.desc_type = APR_POLL_SOCKET;
                     new_pollfd.reqevents = APR_POLLIN;
@@ -1777,14 +1806,14 @@ static void test(void)
 static void copyright(void)
 {
     if (!use_html) {
-       printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.4 $> apache-2.0");
+       printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.5 $> apache-2.0");
        printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
        printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n");
        printf("\n");
     }
     else {
        printf("<p>\n");
-       printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.4 $");
+       printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.5 $");
        printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
        printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n");
        printf("</p>\n<p>\n");