cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ftp remembers wrong prevpath

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 23 Nov 2005 09:01:50 +0100 (CET)

On Tue, 22 Nov 2005, Zibiao.Wei_at_atxinc.com wrote:

> Try this ftp test using libcurl
> 1. CWD to path_a and download an existing file_a.
> 2. CWD to path_b and try to download a non-existing file_b.
> 3. CWD to path_a and download (or upload) file_c.
>
> Since step 2 fails, Curl_ftp_done is not called and ftp->prevpath still
> remembers path_a. At step 3, libcurl thinks it is already at path_a but
> really it is at path_b, therefore libcurl does not CWD to path_a and try to
> download/upload file_c at path_b which is wrong.
>
> My question is why libcurl sets ftp->prevpath in function Curl_ftp_done
> instead of after every successful CWD?

Simple: because that's not how I did it.

The current implementation is a bit simpler than so, and expects the full path
to work or it is not rememembered at all. Indeed room for improvements there!

You up to fixing this?

> Another interesting thing is that I logged into a Windows ftp server with
> anonymous user. At step3 libcurl breaks the security and successfully
> uploads file_c to path_b! If I do a normal uploading, the server denies.

It is hardly libcurl's "fault" if so, since you could easily do that with any
client anyway.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-11-23