cURL / Mailing Lists / curl-library / Single Mail

curl-library

http error with CURLOPT_RESUME_FROM CURLOPT_FAILONERROR

From: zach diubaldo <zulu_at_cisco.com>
Date: Mon, 24 Nov 2003 09:25:38 -0800

Hey all, I am having some problems with downloading a file and using
CURLOPT_FAILONERROR and CURLOPT_RESUME_FROM at the same time. My code
looks something like this:

curl_easy_setopt( pcurl, CURLOPT_CONNECTTIMEOUT, 60 );
curl_easy_setopt( pcurl, CURLOPT_FAILONERROR, TRUE );
curl_easy_setopt( pcurl, CURLOPT_RESUME_FROM, file_size );
curl_easy_setopt( pcurl, CURLOPT_BUFFERSIZE, 14000 );
curl_status = curl_easy_perform( pcurl );

My problem is when the file has already been downloaded. I use the
return from curl_easy_perform() to determine if file that I am download
exits, if it doesn't curl_status = CURLE_HTTP_RETURNED_ERROR. That is
what I would expect and that is good by me. The problem occurs when the
file is valid, but has already been downloaded. Even if the file has
been downloaded in full the above code is executed. When it does
curl_status = CURLE_HTTP_RETURNED_ERROR. This kills me because the url
and file name are correct. I assume that it can't find the file because
of the resume. I have also checked out CURLOPT_ERRORBUFFER and it is
the same for both. So I am kind of stuck. I guess I could grab the
size of the file from the http headers and not download if I already
have the file, but I would rather not have to parse the http header to
find the size. Any one have any thoughts on this? Thanks in advance.

Zach

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-24