cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to detect end of headers?

From: James Cheng <jcheng_at_tivo.com>
Date: Thu, 19 Feb 2009 11:49:54 -0800

Hi!

I'm using the libcurl easy interface. My application needs to detect when headers are finished being sent and take some action before the body starts processing. What is the recommended way to do this?

I am currently detecting it by using the HEADERFUNCTION callback, and looking for a header that is "\r\n", which I'm guessing will be the final terminating header. Assuming that the server is sending it properly, does libcurl send it along?

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.

Thanks,
-James
Received on 2009-02-19