cURL / Mailing Lists / curl-library / Single Mail


RE: Request To Memory Buffer

From: Uygar Gümüs <>
Date: Fri, 8 Jun 2007 11:10:44 +0300

SAX interface of libxml has a similar ability. You can read xml data from a file or a memory block like this

#include <libxml/parser.h>

int xmlSAXUserParseFile( xmlSAXHandlerPtr sax,
        void * user_data,
        const char * filename);
int xmlSAXUserParseMemory( xmlSAXHandlerPtr sax,
        void * user_data,
        char * buffer,
        int size);

i don`t know if i could tell what i mean :(


-----Original Message-----
From: Uygar Gümüs
Sent: Fri 6/8/2007 11:05 AM
To: libcurl development
Subject: RE: Request To Memory Buffer

Thanks for quick reply but that example shows saving to memory. My case is about reading from that memory block like reading from server url.

For example
I saved data for http:///xxx.y to buffer as shown in example and than at second attempt to request http:///xxx.y do not make a curl request to server but read data from that buffer with curl callbacks (write callback actually) My code should be like this...

if(url not in cache)
     curl_easy_setopt(curl_handle, CURLOPT_URL, "");

    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteCallback);

    curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);

  [do something to force curl read from memory]

I am doing this because there are some code blocks which assumes that "data will be given from CURLOPT_WRITEFUNCTION callback, not directly" and i don`t want to change that part because of possible changes by developers of that parts.




-----Original Message-----
From: on behalf of Aleksandar Lazic
Sent: Fri 6/8/2007 10:18 AM
To: libcurl development
Subject: Re: Request To Memory Buffer

On Fre 08.06.2007 09:40, Uygar Gümüs wrote:
>I need some help about libcurl interface. Please help me.

Have you try to look into the *excellent* examples dir:


>Can you please reply... Thanks a lot

Ht the urls help ;-)


Received on 2007-06-08