ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck>
Subject [PATCH] Add passive-mode transfer to FTP Task
Date Wed, 15 Nov 2000 16:22:02 GMT
Having just add a firewall to our location I noticed that the current FTP task doesn't have
a passive mode option.

Here are the patches to add it in.  I've also included patches to the index.html doc to include
the additional documentation.  Apologies, my HTML editor was a little bit stricter and forced
me to fix the odd out of order </p> etc.


RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Attic/,v
retrieving revision 1.3
diff -u -r1.3
---	2000/09/07 09:50:57	1.3
+++	2000/11/15 16:00:01
@@ -88,6 +88,7 @@
     private String password;
     private File listing;
     private boolean binary = true;
+    private boolean passive = false;
     private boolean verbose = false;
     private boolean newerOnly = false;
     private int action = SEND_FILES;
@@ -251,6 +252,16 @@
+     * Specifies whether to use passive mode.  Set to true if you
+     * are behind a firewall and cannot connect without it.  Passive mode
+     * is disabled by default.
+     */
+    public void setPassive(boolean passive)
+    {
+        this.passive = passive;
+    }
+    /**
      * Set to true to receive notification about each file as it is
      * transferred.
@@ -743,6 +754,18 @@
                     throw new BuildException(
                         "could not set transfer type: " +
+                        ftp.getReplyString());
+                }
+            }
+            if (passive)
+            {
+                log("entering passive mode", Project.MSG_VERBOSE);
+                ftp.enterLocalPassiveMode();
+                if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
+                {
+                    throw new BuildException(
+                        "could not enter into passive mode: " +

Index: index.html
RCS file: /home/cvspublic/jakarta-ant/docs/index.html,v
retrieving revision 1.146
diff -u -r1.146 index.html
--- index.html	2000/11/06 14:10:56	1.146
+++ index.html	2000/11/15 16:13:46
@@ -105,7 +105,7 @@
   Once installed make sure the &quot;jaxp.jar&quot; and &quot;parser.jar&quot;
files are in your classpath.
   You will also need the JDK installed on your system, version 1.1 or later. 
+  </p>
 <h2><a name="buildingant">Building Ant</a></h2>
 <p>Go to the directory <code>jakarta-ant</code>.</p>
@@ -734,7 +734,7 @@
 If you do not want these default excludes applied, you may disable them with the 
-<code>defaultexcludes=&quot;no&quot;</code> attribute.</p>
+<code>defaultexcludes=&quot;no&quot;</code> attribute.
 <h3><a name="patternset">PatternSets</a></h3>
 <p>Patterns can be grouped to sets and later be referenced by their id
 attribute. They are defined via a <code>patternset</code> element -
@@ -1883,7 +1883,7 @@
 build.xml:4: No message
 <pre>  &lt;fail message=&quot;Something wrong here.&quot;/&gt;</pre>
 <p>will exit the current build and print something like the following to whereever
 your output goes:
@@ -1892,7 +1892,7 @@
 build.xml:4: Something wrong here.
 <h2><a name="filter">Filter</a></h2>
@@ -2344,6 +2344,7 @@
 If <code>create</code> (the default), the JAR is created anyway with only a manifest.
 If <code>skip</code>, the JAR is not created and a warning is issued.
 If <code>fail</code>, the JAR is not created and the build is halted with an
 <table border="1" cellpadding="2" cellspacing="0">
@@ -3377,7 +3378,7 @@
 <h2><a name="patch">Patch</a></h2>
-<p>Applies a diff file to originals.
+<p>Applies a diff file to originals.</p>
 <table border="1" cellpadding="2" cellspacing="0">
@@ -3517,7 +3518,7 @@
 to be your home directory.  This technique is more appropriate for Unix than 
 Windows since the notion of a home directory doesn't exist on Windows.  On the
 JVM that I tested, the home directory on Windows is &quot;C:\&quot;.  Different JVM
-implementations may use other values for the home directory on Windows.
+implementations may use other values for the home directory on Windows.</p>
 <h2><a name="rename">Rename</a></h2>
@@ -3938,7 +3939,7 @@
 &lt;style basedir=&quot;doc&quot; destdir=&quot;build/doc&quot;
        extension=&quot;html&quot; style=&quot;style/apache.xml&quot;/&gt;
 <h2><a name="tar">Tar</a></h2>
@@ -4406,7 +4407,7 @@
 using Ant's default manifest file. The content of
 <code>WEB-INF/web.xml</code> is identical to
 <h2><a name="zip">Zip</a></h2>
@@ -4721,6 +4722,12 @@
     <td valign="top" align="center">No</td>
+    <td valign="top">passive</td>
+    <td valign="top">selects passive-mode (&quot;yes&quot;) transfers.  
+                     Defaults to &quot;no&quot;</td>
+    <td valign="top" align="center">No</td>
+  </tr>
+  <tr>
     <td valign="top">verbose</td>
     <td valign="top">displays information on each file transferred if set 
                      to &quot;yes&quot;. Defaults to &quot;no&quot;.</td>
@@ -4789,20 +4796,19 @@
 <p>Logs in to <code></code> at port <code>2121</code>
 <code>coder</code> with password <code>java1</code> and uploads all
new or 
 changed HTML files in the <code>htdocs/manual</code> directory to the 
-<code>/pub/incoming</code> directory.  The files are transferred in text
+<code>/pub/incoming</code> directory. The files are transferred in text mode.
Passive mode has been switched on to send files from behind a firewall.</p>
 <pre>  &lt;ftp server=&quot;;
-       verbose=&quot;yes&quot;
+       verbose=&quot;yes&quot;</pre>
     &lt;fileset dir=&quot;htdocs/manual&quot;&gt;
       &lt;include name=&quot;**/*.html&quot; /&gt;
-  &lt;/ftp&gt;</pre>
-<p>Logs in to the Windows-based <code></code> as 
+  &lt;/ftp&gt;</PRE><p>Logs in to the Windows-based <code></code>
 <code>coder</code> with password <code>java1</code> and uploads all

 HTML files in the <code>htdocs/manual</code> directory to the 
 <code>c:\uploads</code> directory.  Progress messages are displayed as each

View raw message