cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getting CURL parse the body

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 24 Oct 2013 23:41:43 +0200 (CEST)

On Thu, 24 Oct 2013, Sivasamy, Kalidoss wrote:

> I am able to get the headers with the option below and parse the headers
> fine. curl_easy_setopt(m_pCurl, CURLOPT_HEADER, 1);
>
> But how can I parse header and body from the same stream? I tried to go one
> line after the HTTP headers, it doesn't see to work. Any ideas or a link to
> a similar discussion?

Why make it so hard for yourself? libcurl already separates the headers from
the body for you, if you just made use of the separate callbacks.

But if you insist, you can indeed find the first header with nothing but a
CRLF or LF and use that as an end of headers marker. Unless you get more
headers due to authenticaion, redirects, CONNECT responses etc.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-24