cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: FTP listing

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 21 Nov 2001 09:41:45 +0100 (MET)

On Wed, 21 Nov 2001, monkeyiq wrote:

> I am adding the ability for ferris to mount ftp sites as a filesystem
> using libcurl (7.9.1). I am having problems getting a ftp LIST.
>
> If I just insert the URL
> ftp://host//
> then I get a nice connection
> * Entry path is '/'
> * Connected to host (x.x.x.x)
> > PASV
> < 227 Entering Passive Mode (xxx)
> * Connecting to host (x,x,x,x) port 63355
> * Connected the data stream!
> > TYPE A
> < 200 Type set to A.
> > LIST
> < 150 Opening ASCII mode data connection for directory listing.
> * Getting file with size: -1
> FerrisCurlState_write_cb() totalsize:249
> FerrisCurlState_write_cb() ptr:total 0
> d--x--x--x 2 root root 87 Nov 3 03:19 bin
> d--x--x--x 2 root root 66 Nov 2 11:19 etc
> drwxr-xr-x 2 root root 69 May 1 2001 lib
> drwxr-xr-x 2 root 50 114 Nov 20 17:08 pub
>
> < 226 Transfer complete.
>
> Which is all cool, but when I try using a QUOTE command of
> LIST -la
> or
> PASV
> LIST -l
>
> then I get big problems. The PASV seems to hang because I have switched
> to pasive mode, not curl. and the LIST -l

Yes, that was expected. You cannot use any such commands (that require a
second connection) in the QUOTE list.

If anyone can think of a good way to put that in a way that people will
understand, I'll appreciate a paragraph to add to the docs!

> < 257 "/" is current directory.
> * Entry path is '/'
> * Connected to host ()
> > LIST -l
> < 425 Can't build data connection: Connection refused.
> ls.cpp cought:CurlPerformFailed, 525:libcurl.cpp Ferris::FerrisCurlState &Ferris::FerrisCurlClass::operator() (Ferris::FerrisCurlState &)curl_easy_perform() failed:QUOT string not accepted: LIST -l return code:21
> * Closing connection #0
>
> note that libcurl.cpp is my curl module.
>
> Is there a way to tell curl what arguments you want for the LIST command?
> or to be able to switch to PASV before a QUOTE?

You should use the CUSTOMREQUEST option. It'll replace the "LIST" command
with whatever you specify.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-11-21