cURL / Mailing Lists / curl-users / Single Mail

curl-users

Problems caching data (libcurlnet)

From: Farkas H <farkas.dus_at_gmail.com>
Date: Mon, 3 Sep 2012 10:39:12 +0200

Hi everyone,

I send http-get requests via curl (libcurlnet 1.3) and want to cache the data.
It doesn't work, curl seems to make the data not cacheable.
I changed the CURLOPT_HTTPHEADER but that wasn't successful.
Squid access.log: "... TCP_CLIENT_REFRESH_MISS/200 ..."
Please find my code here [1].

I gratefully appreciate any advice.
Thanks,
Farkas

[1]
...
Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

Easy easy = new Easy();
Slist slist = new Slist();

string Proxy = "http://127.0.0.1:3130";
easy.SetOpt(CURLoption.CURLOPT_PROXY, Proxy);
easy.SetOpt(CURLoption.CURLOPT_PROXYTYPE, CURLproxyType.CURLPROXY_HTTP);
Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

slist.Append("Cache-Control: public");
easy.SetOpt(CURLoption.CURLOPT_URL, "http://www...");
easy.SetOpt(CURLoption.CURLOPT_HTTPGET, true);
easy.SetOpt(CURLoption.CURLOPT_HTTPHEADER, slist);
easy.Perform();

slist.FreeAll();
easy.Cleanup();

Curl.GlobalCleanup();
...
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-03