You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/07/17 22:12:14 UTC

[tomcat] branch master updated: 63570: Fix retrieving local address with the NIO connector

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new a6abd65  63570: Fix retrieving local address with the NIO connector
a6abd65 is described below

commit a6abd652314bfcd53182a2de1a97dde6b910b1b6
Author: remm <re...@apache.org>
AuthorDate: Thu Jul 18 00:12:00 2019 +0200

    63570: Fix retrieving local address with the NIO connector
    
    The remote address was retrieved rather than the local address.
    Submitted by Aditya Kadakia.
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 4 ++--
 webapps/docs/changelog.xml                       | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index d41898d..85bfa9d 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1352,7 +1352,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
         protected void populateLocalName() {
             SocketChannel sc = getSocket().getIOChannel();
             if (sc != null) {
-                InetAddress inetAddr = sc.socket().getInetAddress();
+                InetAddress inetAddr = sc.socket().getLocalAddress();
                 if (inetAddr != null) {
                     localName = inetAddr.getHostName();
                 }
@@ -1364,7 +1364,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
         protected void populateLocalAddr() {
             SocketChannel sc = getSocket().getIOChannel();
             if (sc != null) {
-                InetAddress inetAddr = sc.socket().getInetAddress();
+                InetAddress inetAddr = sc.socket().getLocalAddress();
                 if (inetAddr != null) {
                     localAddr = inetAddr.getHostAddress();
                 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index bfe2afd..af61944 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -76,6 +76,10 @@
         Add callback when finishing the set properties rule in the digester.
         (remm)
       </update>
+      <fix>
+        <bug>63570</bug>: Fix regression retrieving local address with
+        the NIO connector. Submitted by Aditya Kadakia. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org