Fix #41973 by not initializing IPV6 if address is null.
authormturk <mturk@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 3 Apr 2007 10:45:51 +0000 (10:45 +0000)
committermturk <mturk@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 3 Apr 2007 10:45:51 +0000 (10:45 +0000)
APR cannot listen both on IPV4 and IPV6 on some platforms
(e.g BSD and Windows).

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@525132 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/AprEndpoint.java

index 59ee888..0706804 100644 (file)
@@ -587,6 +587,15 @@ public class AprEndpoint {
             addressStr = address.getHostAddress();
         }
         int family = Socket.APR_INET;
+        if (Library.APR_HAVE_IPV6) {
+            if (addressStr == null) {
+                if (!OS.IS_BSD && !OS.IS_WIN32 && !OS.IS_WIN64)
+                    family = Socket.APR_UNSPEC;
+            } else if (addressStr.indexOf(':') >= 0) {
+                family = Socket.APR_UNSPEC;
+            }
+         }
+
         if (Library.APR_HAVE_IPV6 && (addressStr == null || addressStr.indexOf(':') >= 0)) {
             family = Socket.APR_UNSPEC;
         }