cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: using curl_easy_recv function to retrieve data from http server without header!!

From: Tetetest <tetetest_at_rambler.ru>
Date: Sat, 22 Feb 2014 15:55:25 +0400

Hello Saidus,

Saturday, February 22, 2014, 3:24:57 PM, you wrote:

SB> I'm trying to download a file from httpserver using
SB> curl_easy_send end curl_easy_recv but I miss some thing !!

SB> when I receive a file and store it on the disk I see that the
SB> response header from the server is in the received file !

In general, you shouldn't do this.
These functions deal with raw data, and they do not handle network
protocols for you. Thus you get a data stream with both headers and
body.

To get the body alone (and benefit from libcurl's fine handling of
many tricky parts of the HTTP protocol), you should use a callback
function.

Here is an example of how to do that:
http://curl.haxx.se/libcurl/c/sepheaders.html

-- 
Best regards,
 Tetetest                            mailto:tetetest_at_rambler.ru
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-22