ProFTPD Reply Code for RETR on a Directory Name
Mike Sheldrake (kelly@anet.net)
Tue, 6 Jul 1999 16:34:43 -0700
I have a PERL FTP script that stopped working, and this is why:
When the PERL's LWP::Protocol::ftp tries to GET this URL:
ftp://username:password@ftp.myhost.com/mydirectory
it first tries to retrieve (RETR) "mydirectory" as if it were a file.
When this fails, LWP::Protocol::ftp makes a directory listing request (NLST)
on "mydirectory", but only if the FTP reply code to the RETR equals "550".
If it equals anything else, LWP::Protocol::ftp will return a "Bad Request"
error because the FTP server returns "mydirectory: Not a regular file".
My FTP server is replying with "553". LWP::Protocol::ftp does not check for
this code. Perhaps it should. Or perhaps the FTP server should send "550"
instead, as others do.
The FTP server software in question: ProFTPD 1.1.7p13
The version of LWP::Protocol::ftp in question: 1.24
RFC 959, Section 4.2 defines the FTP reply codes like this:
550 Requested action not taken. File unavailable (e.g., file not found, no
access).
553 Requested action not taken. File name not allowed.
The ProFTPD folks decided to use 553, and I don't blame them, but "File name
not allowed" is ambiguous. Was 553 intended to mean "The filename you
requested is not allowed (because there is a problem with the filename)." or
"You aren't allowed to send a filename with this request."?
I don't know who should change their code. I hope to hear of a discussion
and agreement. In the meantime, I'll get by with my modified version of
LWP::Protocol::ftp. Line 179 now reads:
} elsif (!length($remote_file) || $ftp->code == 550 || $ftp->code == 553) {
- Mike Sheldrake
kelly@anet.net