Try this: fetch the file using a browser, if you get the correct copy then sniff whatever headers the browser is sending and match them.
On Thu, Jan 12, 2012 at 8:44 AM, Arif Ali Saiyed <[email protected]> wrote: > Hi Daniel, > Thanks for your response, > I have tried all following option and it doesn't seems to work for me. > //pHeader=curl_slist_append(pHeader,"Pragma: > no-cache"); // Option 1 > pHeader=curl_slist_append(pHeader,"Cache-Control: > no-cache"); // Option 2 > //pHeader=curl_slist_append(pHeader,"Cache-Control: > must-revalidate"); // Option 3 > //pHeader=curl_slist_append(pHeader,"Cache-Control: > max-age=0"); // Option 4 > //pHeader=curl_slist_append(pHeader,"Expires: Thu, 01 Dec > 1994 16:00:00 GMT"); // Option 5 > curl_easy_setopt(handle,CURLOPT_HTTPHEADER,pHeader); > > First Attempt : Tried only option 1 > Second Attempt : Tried option 1 + Option 2 > Third Attempt : Tried option 1 + Option 2 + Option 5 > Fourth Attempt : Tried only option 3 > fifth Attempt : Tried only option 4 > > but none of these seems to have worked , > I saw one more post http://curl.haxx.se/mail/lib-2005-04/0022.html > But it seems I have already tried all these options. > > I have monitored my network traffic using the "Microsoft Network Monitor > 3.4" > And I see the http request packet , > ProtocolVersion is HTTP/1.1 > and there then I see all the headers that I have set Pragma, > ChacheControl, Expires etc. > since ProtocolVersion is HHTP/1.1 ChacheControl should have worked > ideally isn't it? > > Is there anything that I am still missing. > -Arif > > ------------------------------ > > Message: 2 > Date: Wed, 11 Jan 2012 13:56:28 +0100 (CET) > From: Daniel Stenberg <[email protected]> > To: libcurl development <[email protected]> > Subject: Re: Query regarding the caching problem faced with curl > 7.19.3, how to disable cache usage ? > Message-ID: <[email protected]> > Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII > > On Wed, 11 Jan 2012, Arif Ali Saiyed wrote: > > > my problem is even after the file is being updated on web server, It's > > still downloading the cached copy of it. > > This is not due to any caching done by curl though, as curl has no caching > of contents at all - ever. > > > after some search I found that there is something called > "Pragma:nochache" > > header, but I am not sure how to use this ? there is no > > curl_easy_setopt for doing this. > > You insert that header into a request by yourself with CURLOPT_HTTPHEADER. > See http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPHEADER > > -- > > / daniel.haxx.se > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 11 Jan 2012 18:10:31 +0530 > From: Arif Ali Saiyed <[email protected]> > To: "[email protected]" <[email protected]>, > "[email protected]" <[email protected]> > Subject: Query regarding the caching problem faced with curl 7.19.3, > how to disable cache usage ? > Message-ID: > < > b815c26f687d26448a336840033924ed4203329...@indiambx01.corp.adobe.com> > Content-Type: text/plain; charset="us-ascii" > > Hi There, > I am using curl 7.19.3 in my C++ code. > > My code fetches some http file, my problem is even after the file is > being updated on web server, It's still downloading the cached copy of it. > > I want to know how to disable this behavior I have tried following easy > set option but it did not work me > curl_easy_setopt(handle, CURLOPT_FRESH_CONNECT, 1); // I > guess this has got nothing to do with cache but still I tried and it did > not help > curl_easy_setopt(handle, CURLOPT_FORBID_REUSE, 1); // I > guess this has got nothing to do with cache but still I tried and it did > not help > curl_easy_setopt(handle, CURLOPT_SSL_SESSIONID_CACHE, 0); // I > guess this has got nothing to do with cache but still I tried and it did > not help > > after some search I found that there is something called "Pragma:nochache" > header, but I am not sure how to use this ? there is no curl_easy_setopt > for doing this. > > Though its not needed following is the codesnippet of how I am using curl > > CURL* handle = curl_easy_init(); > CURLcode err = CURLE_READ_ERROR; > if(handle) > { > currentStatus = kInitiated; > curl_easy_setopt(handle, CURLOPT_URL, myFileName); > curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, > my_write_data_handler); > err = curl_easy_perform(handle); > curl_easy_cleanup(handle); > curl_global_cleanup(); > currentStatus = kCompleted; > } > > -asaiyed > > ------------------------------------------------------------------- > List admin: http://cool.haxx.se/list/listinfo/curl-library > Etiquette: http://curl.haxx.se/mail/etiquette.html >
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
