curl-library
RE: Request To Memory Buffer
Date: Fri, 8 Jun 2007 11:05:20 +0300
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, "http://cool.haxx.se/");
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
}
else
{
[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.
curl_easy_perform(curl_handle);
curl_easy_cleanup(curl_handle);
Uygar....
-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se on behalf of Aleksandar Lazic
Sent: Fri 6/8/2007 10:18 AM
To: libcurl development
Subject: Re: Request To Memory Buffer
Hi,
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:
http://curl.haxx.se/libcurl/c/example.html
=> http://curl.haxx.se/lxr/source/docs/examples/getinmemory.c
>Can you please reply... Thanks a lot
Ht the urls help ;-)
Cheers
Aleks
- application/ms-tnef attachment: winmail.dat