curl-library
http resume
Date: Mon, 23 Feb 2004 20:32:05 +0100
Hello.
I am a newbie to curlib. Just now I am using it to get some (binary) files
from a web server in my application. I am using v.7.10.8 from C code over
WindowsXP SP1.
I am having two problems, one of them I am really unable to solve.
In the first place, I don't know how to get an error from libcurl whenever
the file I want to download is not in the server, or the server didn't
allow me to get access to it: curlLib just get a little file and returns
OK. Just now I am suppossing the server (if connected) returns an
http-formatted human-readable error, and so I am checking if the writting
callback if the very first bytes of the file are "<http>". If so, I return
0 in order to abort the download. Is this the only way to get curl to
returns a failure in these cases?
On the other hand, as far as I must download quite big-sized files, I
would like to resume downloads when available data is in my local disk and
the server supports this operation. I am testing with a server which
doesn't support resume (as far as I can see from the results, and check by
using verboursly comand line version of curl). When I set
CURLOPT_RESUME_FROM I get Ok from curl_easy_perform, while the downloaded
result is a buffer just sized=(totalFileSize - resumedBytes), but starting
from the beggining of the file !!!
How can I realize the server doesn't support resume before having
(wrongly) downloaded all the file ? How can I get Curl to return me that error?
As far as command line curl shows that at the very beggining of the
downloading, I asume curllib knows it....
I have try to use CURLOPT_VERBOSE + CURLOPT_STDERR over an opened FILE*
(fopen("filename","w")) in order to check the process in depth but then I
get a crash....
Thanks for your sure help !!
Eduardo García
Received on 2004-02-23