[windev] Downloading data files with Visual C++ MFC and cache issue
Serge Wautier
serge at wautier.net
Wed May 5 21:44:01 GMT 2010
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.
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
More information about the Windev
mailing list