cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: A few more questions

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 22 May 2003 23:37:34 +0200 (CEST)

On Thu, 22 May 2003, Matt Veenstra wrote:

> With threads on unix based systems, should I always set the
> CURLOPT_NOSIGNAL. Of course I must do this if I want a timeout, but is
> this the safe approach?

Yes it is. With NOSIGNAL you are guaranteed to not get any signals generated
by libcurl.

> Is there any handy calls to get the header data of an http request. I
> looks like I just parse this myself.

CURLOPT_HEADERFUNCTION perhaps?

> If headers exist is it guaranteed they will always be sent before the body
> data?

Yes. At least for HTTP. For FTP you can actually get "headers" after the
transfer as well.

> Is this the best way to retrieve the size of data if it is known?

If you want.

> With CURLOPT_PROGRESSFUNCTION does the parameter 'long dltotal' return the
> total file size to be downloaded?

Yes, or 0 if it isn't known.

> I guess I should just check this myself, but don't know what happens when
> file sizes are not known etc. Does the progress function get called first
> before any data is downloaded?

You shouldn't count on it, but it might. It can also be called with dltotal
set to 0 multiple times before it gets to know the size and then gets called
with the expected size set to non-zero.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
Received on 2003-05-22