cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is it safe to set curl options inside a callback function?

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Sat, 29 Aug 2009 07:26:58 -0500

On Sat, Aug 29, 2009, Milmar Tan wrote:

> What do you mean that things will get more complicated if I enable
> CURLOPT_FOLLOWLOCATION?

If you tell libcurl to follow locations, that means you might get
several redirect responses, and each one might (or might not) have
a content-length header and a response body, and you will need to
ignore all of the sets of headers except the set that begins with
"HTTP/1.? 200 OK". You can still enable your write callback from
the very beginning, if you set up a struct to hold the data buffer,
you can add a flag to tell the write callback whether or not it
should start saving data.

Regards,

 - Jeff
Received on 2009-08-29