cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: size not being reset?

From: David Halbakken <dhalbakken_at_macromedia.com>
Date: Tue, 28 Jan 2003 09:41:41 -0800

Sorry, I should have put more comments into the sample. The sample program:

1. Opens an FTP connection. The code sets CURLOPT_NOBODY to 1 and CURLOPT_URL to ftp://localhost so as to establish an FTP connection without performing any transfers. The return code from curl_easy_perform() is CURLE_OK, and the connection is established;

2. Performs an FTP transfer. The code sets CURLOPT_NOBODY to 0, CURLOPT_URL to ftp://localhost/dhalbakken/test.exe, and passes one CURLOPT_QUOTE string, "TYPE I", so that test.exe gets transferred in binary mode. The return code from curl_easy_perform() is CURLE_OK, and the file "test.exe" downloads without errors;

3. Performs a PWD command. The code sets CURLOPT_NOBODY to 1, CURLOPT_URL to ftp://localhost, and passes two CURLOPT_QUOTE strings, "TYPE A" and "PWD", to check the current working directory. The return code from curl_easy_perform() is CURLE_PARTIAL_FILE instead of CURLE_OK.

This is just one possible flow sequence in my original C++ program. It is quite possible I'm using libcurl incorrectly. But it looks as if libcurl doesn't like to do a transfer then perform another operation that is not a transfer. If conn->size doesn't get reset until another transfer takes place, as you suggest, then that explains the problem. Is there a more appropriate place to reset conn->size to -1?

Dave Halbakken

-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Tuesday, January 28, 2003 8:31 AM
To: libcurl Mailing list
Subject: Re: size not being reset?

On Mon, 27 Jan 2003, Dave Halbakken wrote:

> I am getting a CURLE_PARTIAL_FILE error code where I don't expect it. The
> attached file is a distillation of a C++ program I'm working on. At line 89
> of my attached test.c, I get CURLE_PARTIAL_FILE as a return code from
> curl_easy_perform. It looks as if curl retains the file size from the
> previous transfer, then at line 609 of lib\ftp.c executes the following
> code:
>
> if((-1 != conn->size) && (conn->size != *ftp->bytecountp) &&
> (conn->maxdownload != *ftp->bytecountp)) {
> failf(data, "Received only partial file: %d bytes",
> *ftp->bytecountp);
> return CURLE_PARTIAL_FILE;
>
> conn->size is non-zero, but *ftp->bytecountp is zero, so the code
> returns CURLE_PARTIAL_FILE.

I'm not really seeing the flow. The conn->size is set to -1 in Curl_Tranfer()
which should've been called before any new transfer has been initiated.

What FTP commands were the last ones sent in this connection before it
returned the error?

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
Received on 2003-01-28