]> granicus.if.org Git - apache/commitdiff
Merge r1351737 from trunk:
authorJoe Orton <jorton@apache.org>
Mon, 23 Jul 2012 15:19:37 +0000 (15:19 +0000)
committerJoe Orton <jorton@apache.org>
Mon, 23 Jul 2012 15:19:37 +0000 (15:19 +0000)
* support/ab.c (test, start_connect): Only bind the local end of the
  socket (and look up an address for it) if -B is specified.

Reviewed by: trawick, rjung, jorton

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

CHANGES
support/ab.c

diff --git a/CHANGES b/CHANGES
index 3cb2c9eebc2b375d161dc702fa07954be8c43d4a..b375d746ec6084bf5ebf6d3c402112feea398319 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,8 @@ Changes with Apache 2.4.3
      possible XSS for a site where untrusted users can upload files to
      a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
 
+  *) ab: Fix bind() errors.  [Joe Orton]
+
   *) mpm_event: Don't do a blocking write when starting a lingering close
      from the listener thread. PR 52229. [Stefan Fritsch]
 
index 6b1e98954faf361e40bcbc89407d1e2164d4c13d..d2b1a986f9307665527f6c958f07aee75b4dd4d8 100644 (file)
@@ -1186,8 +1186,10 @@ static void start_connect(struct connection * c)
     apr_err("socket", rv);
     }
 
-    if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) {
-        apr_err("bind", rv);
+    if (myhost) {
+        if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) {
+            apr_err("bind", rv);
+        }
     }
 
     c->pollfd.desc_type = APR_POLL_SOCKET;
@@ -1686,13 +1688,15 @@ static void test(void)
         exit(1);
     }
 #endif              /* NOT_ASCII */
-
-    /* This only needs to be done once */
-    if ((rv = apr_sockaddr_info_get(&mysa, myhost, APR_UNSPEC, 0, 0, cntxt)) != APR_SUCCESS) {
-        char buf[120];
-        apr_snprintf(buf, sizeof(buf),
-                 "apr_sockaddr_info_get() for %s", myhost);
-        apr_err(buf, rv);
+    
+    if (myhost) {
+        /* This only needs to be done once */
+        if ((rv = apr_sockaddr_info_get(&mysa, myhost, APR_UNSPEC, 0, 0, cntxt)) != APR_SUCCESS) {
+            char buf[120];
+            apr_snprintf(buf, sizeof(buf),
+                         "apr_sockaddr_info_get() for %s", myhost);
+            apr_err(buf, rv);
+        }
     }
 
     /* This too */