cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Best way to be notified when *all* headers loaded?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 2 Oct 2001 00:24:02 +0200 (MET DST)

On Mon, 1 Oct 2001, Dan Wood wrote:

> I'm using libcurl to load over HTTP, and I'd like to be informed when the
> header-loading stage is done (including the redirecting if the
> CURLOPT_FOLLOWLOCATION option is set. I'm currently using the
> CURLOPT_HEADERFUNCTION & CURLOPT_WRITEHEADER options so I can grab the
> headers one line at a time, but what I'm really hoping for is to get some
> sort of notification after *all* the headers are loaded but before the
> body loads.

Can't you just use the WRITEFUNCTION and a counter? The first time it gets
called, you know the last header has been sent.

> I'm assuming it's more efficient to so a single curl_easy_perform
> (instead of doing one perform to get the headers and a separate
> invocation with different options to get the body), right?

Oh yes, that would make two requests and that'll take more time definitely.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-10-02