[windev] Downloading data files with Visual C++ MFC andcache issue

Mark McGinty mmcginty at thinkset.com
Wed May 5 22:11:03 GMT 2010


 

> -----Original Message-----
> From: windev-bounces at windev.org 
> [mailto:windev-bounces at windev.org] On Behalf Of Serge Wautier
> Sent: Wednesday, May 05, 2010 2:44 PM
> To: windev at windev.org
> Subject: Re: [windev] Downloading data files with Visual C++ 
> MFC andcache issue
> 
> True enough although IE sometimes insists to load pages from 
> cache even if the server says "Cache-control:no-cache" :-( In 
> that case, the only workaround I found was to POST instead of GET.

You can also add a dummy parameter, changing the value for each request,
e.g., 

http://someserver.com/somedoc.asp?dummy=[incremental_value]

Browser cache is indexed by the entire URI requested, including any query
portion (case-sensitively.)  Any variation makes it a new request.

That would be *my* cents... Converting to Euros... Oh damn, here's a
quarter, keep the change.  :-)


-MM



> My 2 cents,
> 
> Serge.
> 
> > -----Original Message-----
> > From: windev-bounces at windev.org 
> [mailto:windev-bounces at windev.org] On 
> > Behalf Of Goran Pusic
> > Sent: mercredi 5 mai 2010 14:15
> > To: windev at windev.org
> > Subject: Re: [windev] Downloading data files with Visual 
> C++ MFC and 
> > cache issue
> > 
> > > Subject: [windev] Downloading data files with Visual C++ MFC and
> > cache
> > > issue
> > >
> > > VC++ 2005 MFC Dialog
> > >
> > > Dear Windev Guys and Gals
> > >
> > > I have this code:
> > >
> > >     if( InternetGoOnline( (LPTSTR)(LPCTSTR)strURL, 
> GetSafeHwnd(), 0)
> > )
> > >     {
> > >         TRY
> > >         {
> > >             // Our
> > session should already be open
> > >             // Try to open up
> > Internet session to my URL
> > >             pWebFile =
> > (CHttpFile*)iSession.OpenURL(strURL, 1,
> > >
> > INTERNET_FLAG_TRANSFER_ASCII |
> > > INTERNET_FLAG_DONT_CACHE);
> > >
> > >             if(pWebFile != NULL)
> > >             {
> > >                 pWebFile->QueryInfoStatusCode(dwStatus);
> > >
> > 
> > What Serge said, plus, what you are seeing normally means 
> that URL is 
> > cached and that server version did not changed since.
> > 
> > IOW... OpenURL issues a HEAD request to your server. Server 
> responds 
> > and says that resource is from date/time X. If that 
> date/time is older 
> > than the cached data timestamp, OpenURL does not issue an 
> actual GET 
> > request, but serves cached version.
> > 
> > Note that this is normally an issue with the server, not 
> your code. If 
> > what you are getting is always different, or must always be 
> > recalculated on the server, server should send a correct "Expires"
> > header. It seems that didn't happen.
> > 
> > You could use e.g. WireShark and look at the HTTP requests being 
> > issued, that would clear up the situation.
> > 
> > Goran.
> > 
> > 
> > 
> > 
> > -------------- next part -------------- An HTML attachment was 
> > scrubbed...
> > URL:
> > 
> http://lists.windev.org/pipermail/windev/attachments/20100505/4b52a8d9
> > /
> > attachment.htm
> > --
> > Windev mailing list at Windev at windev.org
> > 
> > Lost your password?  Need to unsubscribe or change your delivery 
> > options?
> > Go to http://lists.windev.org/mailman/listinfo/windev
> > --
> > Search the Windev Archives - www.windev.org
> 
> --
> Windev mailing list at Windev at windev.org
> 
> Lost your password?  Need to unsubscribe or change your 
> delivery options?  
> Go to http://lists.windev.org/mailman/listinfo/windev
> --
> Search the Windev Archives - www.windev.org
> 



More information about the Windev mailing list