From 02e1ec295a75841efb10cdb85809c8ccec951bb0 Mon Sep 17 00:00:00 2001 From: Steve Oswald <30654895+SteveOswald@users.noreply.github.com> Date: Tue, 6 Dec 2022 12:05:24 +0100 Subject: [PATCH] Fixing proxy-problems in _parsePassiveModeReply FTPClient in passive mode didn't worked, when using a proxy, cause the FTPClient tried to open a data-connection to the proxy-host instead the reals passive-host. This was caused, cause the passiveHost was ALWAYS overwritten by the socket-address (wich is the address of the proxy-host). The passive-host should ALWAYS be parsed from the pasvResponse and only be overwritten, when the pasvResponse is a "look lie IP address" (0,0,0,0). --- src/main/java/org/apache/commons/net/ftp/FTPClient.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/apache/commons/net/ftp/FTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPClient.java index f5081fb32..1a38d6546 100644 --- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java +++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java @@ -853,8 +853,6 @@ protected void _parsePassiveModeReply(final String reply) throws MalformedServer } } else if (_socket_ == null) { pasvHost = null; // For unit testing. - } else { - pasvHost = _socket_.getInetAddress().getHostAddress(); } this.passiveHost = pasvHost; this.passivePort = pasvPort;