Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47319
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 6 Jan 2011 17:02:27 +0000 (17:02 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 6 Jan 2011 17:02:27 +0000 (17:02 +0000)
Don't return null for getRemoteHost() if the IP address cannot be resolved.

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

java/org/apache/coyote/http11/Http11AprProcessor.java
webapps/docs/changelog.xml

index ba0a212..3eca711 100644 (file)
@@ -464,6 +464,9 @@ public class Http11AprProcessor extends AbstractHttp11Processor {
                 try {
                     long sa = Address.get(Socket.APR_REMOTE, socketRef);
                     remoteHost = Address.getnameinfo(sa, 0);
+                    if (remoteHost == null) {
+                        remoteHost = Address.getip(sa);
+                    }
                 } catch (Exception e) {
                     log.warn(sm.getString("http11processor.socket.info"), e);
                 }
index a842104..f7a884f 100644 (file)
   </subsection>
   <subsection name="Coyote">
     <changelog>
+      <fix>
+        <bug>47319</bug>: Return the client&apos;s IP address rather than null
+        for calls to <code>getRemoteHost()</code> when the APR connector is
+        used with <code>enableLookups=&quot;true&quot;</code> but the IP address
+        is not resolveable. (markt)
+      </fix>
       <add>
         <bug>50108</bug>: Add get/set methods for Connector property
         minSpareThreads. Patch provided by Eiji Takahashi. (markt)