cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: How to detect end of headers?

From: James Cheng <jcheng_at_tivo.com>
Date: Mon, 23 Feb 2009 09:33:02 -0800

Thanks for the suggestion. I turns out I need to parse some other headers anyway, so I'll do it in my HEADERFUNCTION callback.

On that subject, aside from the header callback, does libcurl provide any way to get arbitrary headers from the response headers? Something where I can pass a string to find, say "Cache-control", and it would return the value for the header?

Thanks,
-James

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Friday, February 20, 2009 1:54 AM
> To: libcurl development
> Subject: Re: How to detect end of headers?
>
> On Thu, 19 Feb 2009, Jamie Lokier wrote:
>
> >> My other thought was to have my code run within the
> WRITEFUNCTION callback,
> >> but if the response has Content-Length:0, then it looks
> like the body
> >> callback is never called.
> >
> > If the response has Content-Length:0 then the whole request
> finishes when
> > the headers are done; you can easily detect that :-)
>
> I would even encourage that approach since that way you don't
> have to parse
> any headers at all...
>
> --
>
> / daniel.haxx.se
>
Received on 2009-02-23