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,14 @@ 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+ protected String _resolveExtendedPassiveModeHost () {
836+ return getRemoteAddress ().getHostAddress ();
837+ }
838+
835839 /**
836840 * Parses a reply.
837841 *
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