Hack-

I'm not sure it's the server's fault per se; I get errors with wget I don't
get it with NCFTP on the same server.

Not trying to sound simplistic or anything, but the actual FTP command is
"ascii", not "type=a". Can you see if providing this doesn't work instead?

Clayton



-----Original Message-----
From: Hack Kampbjørn [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 10, 2001 3:05 PM
To: Clayton Vernon
Cc: [EMAIL PROTECTED]
Subject: Re: f/up bug


Clayton Vernon wrote:
>
> Hack-
>
> While it now "seems" to parse correctly, and while it displays "TYPE A" in
> its download dialog, it does NOT actually download the file in ASCII
format,
> but in binary.
>
> Clayton

I have been testing this against MS so called "FTP Server". And I to get
the same file no matter which type I use. I have tried files with CRLF
line endings and files with NL line endings.

Quoting from RFC959
3.1.1.1.  ASCII TYPE

            This is the default type and must be accepted by all FTP
            implementations.  It is intended primarily for the transfer
            of text files, except when both hosts would find the EBCDIC
            type more convenient.

            The sender converts the data from an internal character
            representation to the standard 8-bit NVT-ASCII
            representation (see the Telnet specification).  The receiver
            will convert the data from the standard form to his own
            internal form.

            In accordance with the NVT standard, the <CRLF> sequence
            should be used where necessary to denote the end of a line
            of text.  (See the discussion of file structure at the end
            of the Section on Data Representation and Storage.)

            Using the standard NVT-ASCII representation means that data
            must be interpreted as 8-bit bytes.

            The Format parameter for ASCII and EBCDIC types is discussed
            below.


There seems to be two problems here:
  1. MS FTP Server always sends the file in binary mode.
  2. wget always saves the file in binary mode.


First I try on a MS FTP Server (look at how the byte count is the same
in both cases, this is expected if the file has only CRLF line endings
but we have the same result with binary files)
$ wget-dev -S -d -O readme-A.htm
ftp://ftp.nai.com/pub/antivirus/readme.htm\;type=A
DEBUG output created by Wget 1.7-dev on cygwin32.
[...]
220 sncwebftp2 Microsoft FTP Service (Version 5.0).
[...]
200 PORT command successful.
--> RETR readme.htm

150 Opening ASCII mode data connection for readme.htm(592 bytes).
Created socket fd 6.
Length: 592

    0K ->                                                        [100%]

Closing fd 6
Closing fd 5
226 Transfer complete.
23:27:36 (8.26 KB/s) - `readme-A.htm' saved [592]

Closing fd 4

$ wget-dev -S -d -O readme-I.htm
ftp://ftp.nai.com/pub/antivirus/readme.htm\;type=I
DEBUG output created by Wget 1.7-dev on cygwin32.
[...]
220 sncwebftp2 Microsoft FTP Service (Version 5.0).
[...]
200 PORT command successful.
--> RETR readme.htm

150 Opening BINARY mode data connection for readme.htm(592 bytes).
Created socket fd 6.
Length: 592

    0K ->                                                        [100%]

Closing fd 6
Closing fd 5
226 Transfer complete.
23:30:15 (28.91 KB/s) - `readme-I.htm' saved [592]

Closing fd 4

Now on a Unix FTP server: (look at how the byte count is different in
this case)
$ wget -S -d -O wget-A.html
ftp://sunsite.dk/projects/wget/wget.html\;type=A
DEBUG output created by Wget 1.6.1-dev on cygwin32.
[...]
220 ProFTPD 1.2.0rc3 Server (SunSITE Denmark) [sunsite.dk]
[...]
200 PORT command successful.
--> RETR wget.html

150 Opening ASCII mode data connection for wget.html (5689 bytes).
Created socket fd 6.
Length: 5,689

    0K -> .....                                                  [102%]

Closing fd 6
Closing fd 5
226 Transfer complete.
23:50:32 (6.35 KB/s) - `wget-A.html' saved [5804]

]$ wget -S -d -O wget-I.html
ftp://sunsite.dk/projects/wget/wget.html\;type=I
DEBUG output created by Wget 1.6.1-dev on cygwin32.
[...]
220 ProFTPD 1.2.0rc3 Server (SunSITE Denmark) [sunsite.dk]
[...]
200 PORT command successful.
--> RETR wget.html

150 Opening BINARY mode data connection for wget.html (5689 bytes).
Created socket fd 6.
Length: 5,689

    0K -> .....                                                  [100%]

Closing fd 6
Closing fd 5
226 Transfer complete.
23:50:47 (3.91 KB/s) - `wget-I.html' saved [5689]

$ ls -als
total 13
   2 drwxrwxrwx   2 administ Administ     4096 Feb 11 00:01 .
   4 drwxrwxrwx  13 administ Administ     8192 Feb 10 20:33 ..
   0 -rw-rw-rw-   1 hack     Administ      592 Feb 10 23:27 readme-A.htm
   0 -rw-rw-rw-   1 hack     Administ      592 Feb 10 23:30 readme-I.htm
   3 -rw-rw-rw-   1 hack     Administ     5804 Feb 10 23:50 wget-A.html
   3 -rw-rw-rw-   1 hack     Administ     5689 Feb 10 23:50 wget-I.html


>
> -----Original Message-----
> From: Hack Kampbjørn [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 04, 2001 11:38 AM
> To: Clayton Vernon
> Cc: [EMAIL PROTECTED]
> Subject: Re: simple ?/bug
>
> Clayton Vernon wrote:
> >
> > Sirs:
> >
> > Pardon my naivete, but  I can't get the ASCII mode FTP to work because
> > my shell thinks the ';' delimits the command.  I can't put the  entire
> > arg to wget in quotes because it then thinks the ';type=a' is a part of
> > the URL.
> >
>
> And it is! wget will parse it correctly. Obs the debug output doesn't
> include the ftp type. I'll submit a patch for this.
>
> The other possibility is to escape the ; with a backslash like \;type=A
>
> $ wget -d "ftp://127.0.0.1/test.bin;type=A"
> DEBUG output created by Wget 1.6.1-dev on cygwin32.
>
> parseurl ("ftp://127.0.0.1/test.bin;type=A") -> host 127.0.0.1 ->
> ftp_type A
>  -> opath test.bin -> dir  -> file test.bin -> ndir
> newpath: /test.bin
>
> > Clayton Vernon
> > Houston, TX
>
> PS: If you're not using the latest and greatest version 1.6 grab it from
> a
> GNU mirror near you or look at the web-site (http://sunsite.dk/wget) for
> instruccions
>
> --
> Med venlig hilsen / Kind regards
>
> Hack Kampbjørn               [EMAIL PROTECTED]
> HackLine                     +45 2031 7799

--
Med venlig hilsen / Kind regards

Hack Kampbjørn               [EMAIL PROTECTED]
HackLine                     +45 2031 7799

Reply via email to