cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: libcurl FTP - directory listing by file mask

From: Alla Bogolubov <abogolub_at_opentext.com>
Date: Fri, 28 Mar 2008 16:30:44 -0400

Transfer of FTP file consisting of the directory contents would be
perfectly fine with us.
However, the attached app fails with the following error:

/home/sambuild/TESTS/CURL> ./lib525_mget
* About to connect() to geniosol9.hcl.com port 21 (#0)
* Trying 10.3.14.92... * connected
* Connected to geniosol9.hcl.com (10.3.14.92) port 21 (#0)
< 220 geniosol9.hcl.com FTP server ready.
> USER sambuild
< 331 Password required for sambuild.
> PASS builder1
< 230 User sambuild logged in.
> PWD
< 257 "/export/home/sambuild" is current directory.
* Entry path is '/export/home/sambuild'
> NLST ART*
< 425 Can't build data connection: Connection refused.
* QUOT command failed with 425
* Closing connection #0
* FTP: a quote command returned error
Bus error(coredump)

It looks like data connection cannot be built when NLST is supplied in
CURLOPT_QUOTE list.
As soon as I uncomment curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, 1) it
works just fine, but as one would expect, it transfers the whole
directory.

This is the functionality that I was trying to implement with libcurl:

/users/sambuild> ftp geniosol9
Connected to geniosol9.
220 geniosol9.hcl.com FTP server ready.
Name (geniosol9:sambuild):
331 Password required for sambuild.
Password:
230 User sambuild logged in.
ftp> dir *.txt
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
-rwxrwxrwx 1 sambuild staff 499 May 12 2006 Employee_10.txt
-rwxrwxrwx 1 sambuild staff 0 May 17 2007 file1.txt
-rwxrwxrwx 1 sambuild staff 2223 May 12 2006 LoaderLog.txt
-rwxrwxrwx 1 sambuild staff 3285 Aug 17 2006 netstat_file.txt
-rw-r--r-- 1 sambuild staff 2274000000 Mar 19 12:11 test1.txt
-rw-r--r-- 1 sambuild staff 19 Mar 17 14:57 test.txt
226 Transfer complete.
remote: *.txt
409 bytes received in 0.0016 seconds (244.14 Kbytes/s)
ftp> ls *.txt
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
Employee_10.txt
LoaderLog.txt
file1.txt
netstat_file.txt
test.txt
test1.txt
226 Transfer complete.
remote: *.txt
82 bytes received in 0.001 seconds (77.90 Kbytes/s)
ftp>

We have currently implemented FTP functionality w/o libcurl by sending
RFC959 commands via open socket connection. Sending "NLST *.txt" returns
an output identical to 'ls' in built-in client implementation.

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Dan Fandrich
Sent: Friday, March 28, 2008 12:10 PM
To: curl-library_at_cool.haxx.se
Subject: Re: libcurl FTP - directory listing by file mask

On Fri, Mar 28, 2008 at 03:53:16PM +0000, mikep_at_proatria.com wrote:
> Thanks for the explanaition - I misunderstood how this was
implimented.
> So maybe a quote NLST and nobody option would be worth a look?

That won't work, either, because NLST initiates a FTP file transfer
consisting of the directory contents.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address
service
          Let webmasters know that your web site has moved

Received on 2008-03-28