[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] Disabling caching of output?



At 7:49 PM 12/29/00, Riccardo Perotti wrote:
[snip]
>The problem is that once you have downloaded one image and choose another
>one, the browser displays the first outputted image from its cache instead
>of waiting for the script to send the new one. I've tried to disable caching
>of the outputted image by means of http headers, but it's just not working.
>
>I'm enclosing the code of the sub that does the actual outputting.
>Any suggestions would be greatly appreciated.
>
>
>-----snippet----
>
>sub display_img {
>     my $img = shift;
>     my $buffer = '';
>     my $buffer_size = 4_096;  # Is this a good buffer size?
>
>     open (IMAGE, "$img");
>     print $q->header( -type => 'image/jpeg',
>                                     -expires => '-1d',
>                                     'Pragma: no-cache');  ## Using CGI !
>     binmode STDOUT;
>     while ( read(IMAGE, $buffer, $buffer_size) ) {
>         print $buffer;
>         }
>     close (IMAGE);
>}

Have you tried it this way?

print $q->header( -type    => 'image/jpeg',
                   -expires => '-1d',
                   -pragma  => 'no-cache');

HTH

1;

- Bruce

__Bruce_Van_Allen___Santa_Cruz_CA__

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org