FTP Binary , ASCII
Graham Campbell
gc1111 at optonline.net
Tue Aug 24 19:10:30 UTC 2004
On Tue, 2004-08-24 at 04:02, Nifty Hat Mitch wrote:
> On Sun, Aug 22, 2004 at 10:42:41PM -0500, Mike Burger wrote:
> > On Sun, 22 Aug 2004, littleguru wrote:
> >
> > > I as reading a book related to cgi scripts , and it mentioned that we
> > > shouldn't upload
> > > scripts through Binary mode , because they will not work .
> > > Would you please explain to me what is the difference between these two
> > > , when is the
> > > best time to upload with each of them .
> >
> > Whomever told you that, told you wrong. The reverse is actually true.
> > Uploading in ASCII mode can cause your scripts to not work, properly, in
> > that it's possible that you'll have line end/feeds added/removed/changed
> > for each line.
> >
> > Uploading in Binary mode transmits the file, as is, to the destination
> > system. If a script file fails to run, after uploading in binary mode,
> > then it's either got issues, already, or its file permissions aren't
> > correctly set.
>
> True binary transmits the file exactly and 99 44/100% of the time
> that is what is wanted.
Unless you are dealing with machines of different architectures for
example (from a long time ago) CDC machines with 60 bit words and 6 bit
characters.
>
> In some cases there is a desire to make the newline conversion as part
> of the transfer process. This is sometimes needed when editing on
> non Unix style systems (WindowZ) and executing on unix/Linux.
>
> Recently client/server pairs have gotten clever and do this conversion
> on the fly. Perhaps this is because so many windows desktops are used
> to edit content that is then uploaded to Linux. RTFM on the daemon on
> the Linux side and experiment.
>
Not exactly. The FTP protocol was designed in the days when there was a
variety of architectures. Correct handling of the ASCII end-of-line is
part of the FTP specification. Any correctly conforming client/server
pair will translate the end-of-line appropriately - provided you use
ASCII mode. This is one of the main reasons for the ASCII mode.
> This is new functionality to an old unix guy like me. I was
> pleasantly supprised to see that this was done by vs-ftp. I was also
> pleases by how much control the system manager had. Since the Linux
> community has multiple ftp choices this detail can be site dependant.
>
> My old school preference is to make the converions with tools like tr,
> vim, dos2unix and mac2unix and use binary to transfer exactly what I have.
>
> When stuck on a windows box I like cygwin tools like these.
>
> http://sources.redhat.com/cygwin/cygwin-ug-net/using-effectively.html
>
> ...
> "One of the hassles of Unix-Windows interoperability is the
> different line endings on text files. As mentioned in the Section
> called Text and Binary modes, Unix tools such as tr can convert
> between CRLF and LF endings, but cygutils provides several
> dedicated programs: conv, d2u, dos2unix, u2d, and unix2dos. Use the
> --help switch for usage information.:
> ....
>
> In fact this little problem should be one of the errors in the shell
> programming homework assignment we were given. However the
> instructions give away solutions to the problem.
>
> Of interest some scripting languages mostly do not care....
>
> --
> T o m M i t c h e l l
> Just say no to 74LS73 in 2004
--
Graham Campbell <gc1111 at optonline.net>
More information about the fedora-list
mailing list