cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: size not being reset?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 28 Jan 2003 20:22:18 +0100 (CET)

On Tue, 28 Jan 2003, David Halbakken wrote:

> 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?

I think you have identified a bug in libcurl. The size is only reset to -1
when a new transfer is initiated, and it isn't in the case you described and
thus this badness occurs.

Thanks for your detailed and accurate report.

Can you please check if this patch corrects the problem for you?

diff -u -r1.167 ftp.c
--- lib/ftp.c 16 Jan 2003 21:08:13 -0000 1.167
+++ lib/ftp.c 28 Jan 2003 19:21:08 -0000
@@ -2060,6 +2060,7 @@

   /* the ftp struct is already inited in ftp_connect() */
   ftp = conn->proto.ftp;
+ conn->size = -1; /* make sure this is unknown at this point */

   /* We split the path into dir and file parts *before* we URLdecode
      it */

-- 
 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
Received on 2003-01-28