diff options
author | Stefan Bodewig <bodewig@apache.org> | 2021-12-16 19:00:52 +0100 |
---|---|---|
committer | Stefan Bodewig <bodewig@apache.org> | 2021-12-16 19:00:52 +0100 |
commit | 43214e4332867aa62a73df2703d6307dc966c902 (patch) | |
tree | 5230b09f4fefe328cdd489bff0b7e0512ba1d1fc | |
parent | 60a0aa64cd8bbe7177e19b8d44e01028effcea16 (diff) | |
download | ant-43214e4332867aa62a73df2703d6307dc966c902.tar.gz |
add docs for #170 and make host name check strict by default
-rw-r--r-- | WHATSNEW | 3 | ||||
-rw-r--r-- | manual/Tasks/ftp.html | 7 | ||||
-rw-r--r-- | src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java | 28 |
3 files changed, 26 insertions, 12 deletions
@@ -13,6 +13,9 @@ Other changes: of the generated output file from the listener. Github Pull Request #168 +* <ftp> now supports FTPs. + Github Pull Request #170 + Changes from Ant 1.10.11 TO Ant 1.10.12 ======================================= diff --git a/manual/Tasks/ftp.html b/manual/Tasks/ftp.html index 0e3872307..61ba0b760 100644 --- a/manual/Tasks/ftp.html +++ b/manual/Tasks/ftp.html @@ -346,6 +346,13 @@ connection.</p> the <var>serverLanguageCode</var> attribute.<br/><em>Since Ant 1.7</em></td> <td>No</td> </tr> + <tr> + <td>useFtps</td> + <td>Whether to use ftps instead of ftp. Boolean, defauls + to <var>false</var>.<br/> + <em>Since Ant 1.10.13</em></td> + <td>No</td> + </tr> </table> <h3>Note about <var>remotedir</var> attribute</h3> <table> 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 3f45df7fd..8662993fd 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 @@ -115,7 +115,7 @@ public class FTP extends Task implements FTPTaskConfig { private String userid; private String password; private String account; - private boolean useFtps =false; + private boolean useFtps = false; private HostnameVerifier hostnameVerifier; private File listing; private boolean binary = true; @@ -1268,15 +1268,16 @@ public class FTP extends Task implements FTPTaskConfig { this.userid = userid; } + /** + * Whether to use ftps instead of ftp. + * + * @since 1.10.13 + */ public void setUseFtps(boolean useFtps) { this.useFtps = useFtps; } - public HostnameVerifier getHostnameVerifier() { - return hostnameVerifier; - } - - public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + public void add(HostnameVerifier hostnameVerifier) { this.hostnameVerifier = hostnameVerifier; } @@ -2517,13 +2518,16 @@ public class FTP extends Task implements FTPTaskConfig { FTPClient ftp = null; try { - log("Opening FTP connection to " + server, Project.MSG_VERBOSE); - if( useFtps) { - ftp = new FTPSClient(); - if(hostnameVerifier != null){ - ((FTPSClient)ftp).setHostnameVerifier(hostnameVerifier); + if (useFtps) { + log("Opening FTPs connection to " + server, Project.MSG_VERBOSE); + FTPSClient ftps = new FTPSClient(); + ftps.setEndpointCheckingEnabled(true); + if (hostnameVerifier != null) { + ftps.setHostnameVerifier(hostnameVerifier); } - }else{ + ftp = ftps; + } else { + log("Opening FTP connection to " + server, Project.MSG_VERBOSE); ftp = new FTPClient(); } if (this.isConfigurationSet) { |