Incorrect transformation of newline's symbols

2008-10-07 Thread Александр Вильнин

Hello!

I've noticed some posible mistake in ftp-basic.c.

When I try to download a file from 
ftp://www.delorie.com/pub/djgpp/current/; (in my case it was 
ftp://www.delorie.com/pub/djgpp/current/FILES;) server responce error 
no.550. But this file actually exists.

I've used
(wget --verbose --debug --output-file=wget_djgpp_log 
--directory-prefix=djgpp ftp://www.delorie.com/pub/djgpp/current/FILES;)

cygwin command to get this file.

In function ftp_request (ftp-basic.c) newline's characters are 
substituted on ' ', but ftp-server doesn't understand such commands. 
SIZE and RETR commands do not pass.

I've insert debug log at the end of this message.

--restrict-file-names=[windows,unix] option brings no effect.

Yours faithfully, Alexander Vilnin ([EMAIL PROTECTED])

+ wget_djgpp_log +++
DEBUG output created by Wget 1.11.3 on cygwin.

--2008-10-06 17:06:43--  ftp://www.delorie.com/pub/djgpp/current/FILES%0D
   = `djgpp/FILES%0D'
Resolving www.delorie.com... 207.22.48.162
Caching www.delorie.com = 207.22.48.162
Connecting to www.delorie.com|207.22.48.162|:21... connected.
Created socket 4.
Releasing 0x006a0c88 (new refcount 1).
Logging in as anonymous ... 220 delorie.com FTP server (Version 
wu-2.8.0-prerelease(2) Fri Sep 5 11:24:18 EDT 2003) ready.


-- USER anonymous

331 Guest login ok, send your complete e-mail address as password.

-- PASS -wget@

230 Guest login ok, access restrictions apply.
Logged in!
== SYST ...
-- SYST

215 UNIX Type: L8
done.== PWD ...
-- PWD

257 / is current directory.
done.
== TYPE I ...
-- TYPE I

200 Type set to I.
done.  changing working directory
Prepended initial PWD to relative path:
   pwd: '/'
   old: 'pub/djgpp/current'
  new: '/pub/djgpp/current'
== CWD /pub/djgpp/current ...
-- CWD /pub/djgpp/current

250 CWD command successful.
done.
== SIZE FILES\015 ...
Detected newlines in SIZE FILES\015; changing to SIZE FILES 

-- SIZE FILES

550 FILES : not a plain file.
done.
== PASV ...
-- PASV

227 Entering Passive Mode (207,22,48,162,102,137)
trying to connect to 207.22.48.162 port 26249
Created socket 5.
done.== RETR FILES\015 ...
Detected newlines in RETR FILES\015; changing to RETR FILES 

-- RETR FILES

550 FILES : No such file or directory.

No such file `FILES\015'.

Closed fd 5
Closed fd 4
+ wget_djgpp_log +++


Re: Incorrect transformation of newline's symbols

2008-10-07 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Александр Вильнин wrote:
 Hello!
 
 I've noticed some posible mistake in ftp-basic.c.
 
 When I try to download a file from
 ftp://www.delorie.com/pub/djgpp/current/; (in my case it was
 ftp://www.delorie.com/pub/djgpp/current/FILES;) server responce error
 no.550. But this file actually exists.
 I've used
 (wget --verbose --debug --output-file=wget_djgpp_log
 --directory-prefix=djgpp ftp://www.delorie.com/pub/djgpp/current/FILES;)
 cygwin command to get this file.
 
 In function ftp_request (ftp-basic.c) newline's characters are
 substituted on ' ', but ftp-server doesn't understand such commands.
 SIZE and RETR commands do not pass.
 I've insert debug log at the end of this message.

The problem isn't that newlines are substituted. Newlines and carriage
returns are simply not safe within FTP file names.

However, how did the newline get there in the first place? The real file
name itself doesn't have a newline in it. The logs clearly show that
Wget was passed a URL with a carriage return (not newline) in it. This
strongly indicates that the shell you were using passed it that way to
Wget. Probably, the shell was given \r\n when you hit Enter to end
your command, and stripped away the \n but left the \r, which it passed
to Wget.

The bug you are encountering is in your Cygwin+shell environment; you'll
have to look to there. The only deficiency I'm seeing on Wget's part
from these logs, is that it's calling \015 a newline character, when
in fact the newline character is \012; it should say line-ending
character or some such.

- --
HTH,
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
GNU Maintainer: wget, screen, teseq
http://micah.cowan.name/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI67fs7M8hyUobTrERArlfAJ0TurMdyGK0YR9UK263h8p2ZesqXQCfdQo3
Tn4oDFWJg9JIyTEQOJ2jrCE=
=Y/Sy
-END PGP SIGNATURE-