diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java index d435a355a0..eee4f8210b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -2590,6 +2590,10 @@ public void execute() throws BuildException { if (useFtps && useSecureDataChannel) { FTPSClient ftps = (FTPSClient) ftp; try { + // first issue a PBSZ command as mandated by RFC-2228. + // we set 0 because the buffer size is redundant since the encryption + // is handled at TLS layer and not application layer + ftps.execPBSZ(0); ftps.execPROT("P"); // P implies PRIVATE and enables encryption } catch (IOException e) { throw new BuildException("failed to enable secure data channel: " + e, e);