curl-users
Re: Problem with Microsoft 2003 ftp server
Date: Thu, 13 May 2004 14:31:14 +0200
Hi Daniel,
Thanks for your feedback, you helped me dig a little better and correct my
analysis. Here is the scenario, a user named justinkahn tries to connect to
the server in order to emit a LST command. The relative url entered by the
user looks like the following:
/justinkahn/somedir/someotherdir/
Here is the talk between curl and the server:
curl: connect
server: 220 ftp Microsoft FTP Service (Version 5.0).
curl: USER justinkahn
server: 331 Password required for justinkahn.
curl: PASS tiptoe
server: 230 User justinkahn logged in.
curl: PWD
server: 257 "/justinkahn" is current directory.
curl: CWD justinkahn
server: 550 justinkahn: The system cannot find the file specified.
Now if the user enters the following url:
/somedir/someotherdir/
It appears that curl works fine.
However it seems that Microsoft users are used to enter the prefixed url.
Both urls work fine with Internet Explorer on Windows and MacOS X and with
Transmit on MacOS X, so I tend to think that the prefixed url is somewhat
legal, or at least a de facto Microsoft standard, but it's not handled by
curl.
In ftp_perform, I changed the loop to look like the following:
{
int i; /* counter for loop */
for (i=0; ftp->dirs[i]; i++) {
/* RFC 1738 says empty components should be respected too, but
that is plain stupid since CWD can't be used with an empty argument
*/
if ( i==0 && strcmp(ftp->dirs[i],&ftp->entrypath[1])==0)
continue;
if ((result = ftp_cwd_and_mkd(conn, ftp->dirs[i])) != CURLE_OK)
return result;
}
}
With this change, the prefixed url works fine. By the way, why is the dir
stored in ftp->entrypath prefixed with '/' ? I don't think the following
code (also in ftp_perform):
if (conn->bits.reuse && ftp->entrypath) {
if ((result = ftp_cwd_and_mkd(conn, ftp->entrypath)) != CURLE_OK)
return result;
}
can handle this, can it ?
> Can you get a trace of the commands/responses a working client performs with
> the server and see what it sends/receives?
I'd be happy to do this, but I don't know how to do it ? Are there unix
command line tools to do this on MacOS X ?
Eric
> On Thu, 13 May 2004, Eric VERGNAUD wrote:
>
>> When a user named John connects to the server, and curl sends a PWD command
>> to discover the entry point, the server returns:
>>
>> /John/RootDir/SubDir/Etc/
>>
>> Rather than
>>
>> /RootDir/SubDir/Etc/
>
> ... and you are saying that /John is no actual directory?
>
> Can you show us a "curl -v" output from an attempted transfer with this?
>
>> However, when curl then issues a series of CWD command to switch to the
>> target directory, using ftp_cwd_and_mkd, the first call fails with a 550
>> (file doesn't exist).
>
> How come? What does the URL look like that you're trying to fetch?
>
>> Is the Microsoft ftp server behaviour RFC compliant ?
>
> I can't tell yet, I need more input.
>
>> If so, would it be correct to check for equality between user name and
>> directory name for the first path component BEFORE issuing a ftp_cwd_and mkd
>> call, or is it better to check for the error after ?
>
> Such a check would be HORRIBLE. It just must be a way to circumvent that. Do
> you know of any (Microsoft?) documentation describing this?
>
>> Other ftp clients like transmit seem to support this behaviour
>
> Can you get a trace of the commands/responses a working client performs with
> the server and see what it sends/receives?
>
>> I've changed the code in ftp.c to support this, who should I send this to ?
>
> I want more data on this problem before we discuss details on exactly what
> patches that need to be made.
-------------------------------
Eric VERGNAUD - JLynx Software
Cutting-edge technologies and
services for software companies
web: http://www.jlynx.com
-------------------------------
Received on 2004-05-13