cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: FTP 3rd party transfers

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 17 Jan 2005 01:11:21 +0100 (CET)

On Sun, 16 Jan 2005, Alexander Krasnostavsky wrote:

> 2. on the same server:
> ./curl -u user:pass --3rd-host sne465 --3rd-user user:pass --3r
> d-path /tmp/SourceFile.dat ftp://sne465//tmp/TargetFile.dat

Thanks! I've now modified the debug output now in my version, and based on the
new output, I can clearly see that it behaves wrong.

Consider this case: I want to download tmp/file and store it as tmp/file2 on
the same server (localhost).

$ curl -u user:passwd --3rd-host localhost --3rd-user user:passwd --3rd-path
tmp/file ftp://localhost/tmp/file2 -v

Cutting out a couple of lines from the debug trace (only target ones), I get
to see this:

* [Header to localhost]> PWD
* [Header from localhost]< 257 "/data/home/username" is current directory.
* Entry path is '/data/home/username'
* [Header to target localhost]> TYPE I
* [Header from target localhost]< 200 Type set to I.
* [Header to target localhost]> CWD tmp
* [Header from target localhost]< 250 CWD command successful.
* [Header to target localhost]> PASV
* [Header from target localhost]< 227 Entering Passive Mode (127,0,0,1,139,22)
* [Header to target localhost]> STOR tmp/file2
* [Header from target localhost]< 553 tmp/file2: No such file or directory.

See the STOR line? It sends a bad path. It should do "STOR file2" since it
already changed dir into tmp... I wonder how you can make this work? It should
use ftp->file (or conn->proto.ftp->file) and not conn->path. When I fix this,
I get an error that seems more like my server doesn't allow 3rd party
transfers. I should figure out how to make it allow this. (It isn't strictly
necessary since if I just know that curl does it right, I can make the test
server(s) support it.)

Also, a related issue is on the other server. The source side doesn't CWD to
the individual parts of the path, it does a "RETR [full path]". This is
against what the RFCs says and how libcurl works otherwise. No need to fix
this now though, I'll take a look at it in my rewrite work.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2005-01-17