You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Antoine Levy-Lambert <an...@antbuild.com> on 2003/07/29 13:27:31 UTC

Re: ant FTP issue -- "\r\n" line terminators

Your change is tested and committed, will be part of the ant1.6 release and
will be available tomorrow as a nightly build.
Cheers,
Antoine
----- Original Message -----
From: "Nebus, Michael" <Mi...@pfizer.com>
To: "'Antoine Levy-Lambert'" <an...@antbuild.com>
Sent: Tuesday, July 29, 2003 12:25 AM
Subject: RE: ant FTP issue -- "\r\n" line terminators


>
> re: question 1: ..well, maybe? (I think it must be). The FTP server in
> question is (Version 6.5/ OpenBSD, linux port 0.3.2).
> The reason I assumed it's default transfer type was ASCII is because when
I
> tried to connect to it with other FTP Clients (command prompt ftp clients
on
> Win2000, and SunOS 5.8) it appears as thought the default transfer type is
> ascii.  At least, when the first thing I type after successful
> authentication is "type" and the response is "Using ascii mode to transfer
> files."  I receive the same response from both FTP client apps.  I guess
> that could be a client implementation.
>
> I looked all over the system for a *.conf file, /etc/default/ftp file,
> etc... with some switch set to binary, but had no luck.  I actually had a
> hand in the installation of the system in question, and don't recall
making
> any changes to the default configuration.
>
>
>
> re: question 2: ..forget about TELNET_TEXT_FORMAT. It works with
> ftp.setFileType(org.apache.commons.net.ftp.FTP.ASCII_FILE_TYPE);  My
reason
> for trying the TELNET_TEXT_FORMAT was because I thought it was already
using
> ASCII_FILE_TYPE with the default FORMAT.  Looking back, I'm pretty sure
this
> was an invalid assumption.
>
>
>
> My conclusion is that the ftp server is using binary as its default
transfer
> type.  The reasons are the following:
>
> 1. when creating a new instance of FtpClient, the __init_defaults() method
> is called where: this.__fileType = FTP.ASCII_FILE_TYPE
> 2. with this implementation, my script still transfers the file in binary
> (apparently)
> 3. when the ftp.setFileType method is called, my script works.
> 4. the difference between the __init_defaults() and setFileType() methods
is
> that the setFileType() executes the super.type(int) method that issues an
> FTP site command to change the transfer type.
> 5. ..and I got the original script to work on another server
>
> That's proof enough for me.
>
>
> These are the final changes I made to get my implementation to work.
> starting at line 1200 of revision 1.38 of tools.optional.net.FTP
>
> if (binary) {
>
> ftp.setFileType(org.apache.commons.net.ftp.FTP.IMAGE_FILE_TYPE);
> if
> (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
> throw new BuildException(
> "could not set transfer
> type: " + ftp.getReplyString());
> }
> } else {
>
> ftp.setFileType(org.apache.commons.net.ftp.FTP.ASCII_FILE_TYPE);
> if
> (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
> throw new BuildException(
> "could not set transfer
> type: " + ftp.getReplyString());
> }
> }
>
>
> ..and my official definition of the problem is:
> MY ftp server's default transfer type is binary, which is an abnormal
> occurrence.
>
>
> Sorry for any confusion..
> Your help and quick responses are greatly appreciated.
>
> regards,
>
> Michael Nebus
> Pfizer Global R & D
> CIT GS Application Services
> Michael.Nebus@Pfizer.com
> (734) 622-5553
>
>
> -----Original Message-----
> From: Antoine Levy-Lambert [mailto:antoine@antbuild.com]
> Sent: Monday, July 28, 2003 1:43 PM
> To: Nebus, Michael
> Subject: Re: ant FTP issue -- "\r\n" line terminators
>
>
> I have found something in the web about your telnet format :
>
> see http://www.freesoft.org/CIE/RFC/1123/48.htm
>
> I think the clean solution will be to have the ftp task expose alternative
> text formats. From commons-net source code, I see 3 :
>     /***
>      * A constant used for text files to indicate a non-print text format.
>      * This is the default format.
>      * All constants ending in <code>TEXT_FORMAT</code> are used to
indicate
>      * text formatting for text transfers (both ASCII and EBCDIC).
>      ***/
>     public static final int NON_PRINT_TEXT_FORMAT = 4;
>
>     /***
>      * A constant used to indicate a text file contains format vertical
> format
>      * control characters.
>      * All constants ending in <code>TEXT_FORMAT</code> are used to
indicate
>      * text formatting for text transfers (both ASCII and EBCDIC).
>      ***/
>     public static final int TELNET_TEXT_FORMAT = 5;
>
>     /***
>      * A constant used to indicate a text file contains ASA vertical
format
>      * control characters.
>      * All constants ending in <code>TEXT_FORMAT</code> are used to
indicate
>      * text formatting for text transfers (both ASCII and EBCDIC).
>      ***/
>     public static final int CARRIAGE_CONTROL_TEXT_FORMAT = 6;
>
> What would be nicer would be a way to know automagically when to use this
> TELNET_TEXT_FORMAT, but I have no clue.
>
> Cheers,
>
> Antoine
>
>
>
>
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this E-mail
by anyone else is unauthorized. If you are not an addressee, any disclosure
or copying of the contents of this E-mail or any action taken (or not taken)
in reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org