You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2012/07/23 17:19:38 UTC

svn commit: r1364674 - in /httpd/httpd/branches/2.4.x: ./ CHANGES support/ab.c

Author: jorton
Date: Mon Jul 23 15:19:37 2012
New Revision: 1364674

URL: http://svn.apache.org/viewvc?rev=1364674&view=rev
Log:
Merge r1351737 from trunk:

* 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

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/support/ab.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1351737

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1364674&r1=1364673&r2=1364674&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Mon Jul 23 15:19:37 2012
@@ -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]
 

Modified: httpd/httpd/branches/2.4.x/support/ab.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/support/ab.c?rev=1364674&r1=1364673&r2=1364674&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/support/ab.c (original)
+++ httpd/httpd/branches/2.4.x/support/ab.c Mon Jul 23 15:19:37 2012
@@ -1186,8 +1186,10 @@ static void start_connect(struct connect
     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 */