curl-users
Problem with libcURL resuming transfer after doing a directory listing...
Date: Wed, 27 Apr 2005 16:12:51 -0400
Hi guys, I've been having some issues with libcURL... Here's the deal. I
first do a directory listing, and parse the listing... Secondly, in the
callback function that I'm parsing it in, if I come across a certain file, I
try to download it, but it freezes at CWD... Here's a log:
* About to connect() to rz.verisign-grs.com port 21
* Trying XXX.XXX.XXX.XXX... * connected
* Connected to xxx.xxx.xxx (XXX.XXX.XXX.XXX) port 21
< 220-**** Welcome to the XXX FTP Server ****
< 220-***
< 220-*** All sessions established with this server are monitored and
logged.
< 220-*** Disconnect now if you do not consent to having your actions
monitored
< 220-*** and logged.
< 220-***
< 220-******!
< 220-
< 220 FTP server ready.
> USER WWW
< 331 Password required for WWW.
> PASS YYY
< 230 User XXX logged in. Access restrictions apply.
* We have successfully logged in
> PWD
< 257 "/" is current directory.
* Entry path is '/'
* protocol connect phase DONE
* DO phase starts
> CWD directory
< 250 CWD command successful.
* Telling server to connect to ZZZ.ZZZ.ZZZ.ZZZ:17644
> PORT ZZZ,ZZZ,ZZZ,ZZZ,68,236
< 200 PORT command successful.
* Connect data stream actively
* DO phase is comlete
* DO-MORE phase starts
> TYPE A
< 200 Type set to A.
> LIST
< 150 Opening ASCII mode data connection for directory listing.
* Connection accepted from server
* DO-MORE phase ends
!!! NOTE THIS IS WHERE THE DIRECTORY LISTING IS PARSED
!!! THE PARSING DETERMINES
!!! THAT IT NEEDS TO DOWNLOAD THE FILE
!!! SO IT DOES...
* Re-using existing connection! (#0) with host xxx.xxx.xxx
* Connected to xxx.xxx.xxx (XXX.XXX.XXX.XXX) port 21
* DO phase starts
> CWD /
!!! AND AT THIS POINT IT JUST FREEZES... I GET A TIMEOUT AT THIS POINT IF I
USE TIMEOUTS
---------------------------
Anyways, that's the problem... Here's what the code looks like that I'm
using:
curl_easy_setopt(curl, CURLOPT_URL, "ftp://WWW:YYY@xxx.xxx.xxx/directory/");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, directory_parse);
curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl, CURLOPT_FTP_USE_EPRT, TRUE);
---------------------------
As a side note, even though I'm using CUROPT_FPT_USE_EPRT, it doesn't seem
to be working.
---------------------------
Here is some code from the function directory_parse:
curl_easy_setopt(curl, CURLOPT_URL,
"ftp://WWW:YYY@xxx.xxx.xxx/directory/file.tar.gz");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile);
res = curl_easy_perform(curl2);
if (res == 0)
{
bug("Successfully transferred file.tar.gz");
}
else
{
bug("Problem: %s", curl_easy_strerror(res));
}
---------------------------
If I use a second cURL, it works just fine. (IE, if I initialize another
curl, call it curl2, and then use that in the directory_parse function).
Any thoughts? I can't figure out what's wrong! :)
I'm running this on a FreeBSD 5.3 machine:
5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #0: Tue Feb 22 19:28:41 PST 2005
I'm running libcurl 7.13.2. :)
Thanks in advance, folks!!!
Received on 2005-04-27