On Tue, 04 Apr 2006, Octavian Rasnita wrote:
> I have tried to download files using Win32::Internet:
>
> use Win32::Internet;
> my $ua = Win32::Internet->new();
> my $file = $ua->FetchURL($url);
>
> The problem is that even though the files are static files (*.tgz),
> Win32::Internet downloads the files from the cache and not the updated
> files. I don't know why it does this, but is there a way of forcing it to
> download the files from the server and not from the cache?
Win32::Internet doesn't support his explicitly, but you can write your own
version
of FetchURL that would do this. Internally FetchURL() calls:
my $newhandle = InternetOpenUrl($self->{'handle'},$URL,"",0,0,0);
The second last argument to InternetOpenUrl is the flags argument, and you
should be
able to set the INTERNET_FLAG_PRAGMA_NOCACHE bit to bypass the local cache and
rerequest the URL from the original server.
The value of INTERNET_FLAG_PRAGMA_NOCACHE is 0x100.
The full documentation of InternetOpenUrl is here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetopenurl.asp
You can find the hex values of many API flags on this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/api_flags.asp
Cheers,
-Jan
PS: Note that I have not actually tried to use the technique described above, so
I don't know if this is all that is needed.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs