File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/net/ftp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -828,10 +828,20 @@ protected void _parseExtendedPassiveModeReply(String reply) throws MalformedServ
828828 throw new MalformedServerReplyException ("Could not parse extended passive host information.\n Server Reply: " + reply );
829829 }
830830 // in EPSV mode, the passive host address is implicit
831- passiveHost = getRemoteAddress (). getHostAddress ();
831+ passiveHost = resolveExtendedPassiveModeHost ();
832832 passivePort = port ;
833833 }
834834
835+ /**
836+ * Resolve the host for extended passive mode.
837+ *
838+ * @since 3.14.0
839+ * @return the passive host
840+ */
841+ protected String resolveExtendedPassiveModeHost () {
842+ return getRemoteAddress ().getHostAddress ();
843+ }
844+
835845 /**
836846 * Parses a reply.
837847 *
Original file line number Diff line number Diff line change @@ -1119,5 +1119,14 @@ protected void sslNegotiation() throws IOException {
11191119 throw new SSLHandshakeException ("Hostname doesn't match certificate" );
11201120 }
11211121 }
1122+
1123+ @ Override
1124+ protected String resolveExtendedPassiveModeHost () {
1125+ if (_socket_ instanceof SSLSocket ) {
1126+ return ((SSLSocket ) _socket_ ).getSession ().getPeerHost ();
1127+ } else {
1128+ return super .resolveExtendedPassiveModeHost ();
1129+ }
1130+ }
11221131}
11231132
You can’t perform that action at this time.
0 commit comments