cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: http resume

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 25 Feb 2004 13:51:23 +0100 (CET)

On Mon, 23 Feb 2004, Eduardo García wrote:

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

Yes, as that is not an error in the eyes of libcurl. You might want to
download that file. Use curl_easy_getinfo() and extract the
CURLINFO_RESPONSE_CODE after a transfer to get the HTTP-code from the response
(or parse the response headers yourself).

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

libcurl tries to detect that situation (and test case 38 verifies this). Can
you show us exactly what headers your server returns and what libcurl options
to use? Preferably, you provide us with a complete test source using a public
URL that makes the bug appear!

> How can I realize the server doesn't support resume before having
> (wrongly) downloaded all the file ?

libcurl checks for the ""Content-Range:" header in the response.

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

I suppose this is on Windows? Then use CURLOPT_DEBUGFUNCTION instead.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
Received on 2004-02-25