1 #!/usr/bin/perl -wT 2 use strict; 3 4 print "Content-Type: text/plain\n"; 5 print "Cache-Control: no-store\n"; 6 print 'Cache-Control: no-cache="set-cookie"' . "\n"; 7 8 my $cookie = $ENV{"HTTP_CLEAR_COOKIE"}; 9 10 if ($cookie =~ /Max-Age/i) { 11 $cookie =~ s/Max-Age *= *[0-9]+/Max-Age=0/i; 12 } else { 13 $cookie .= ";" unless ($cookie =~ m/;$/); 14 $cookie .= " " unless ($cookie =~ m/ $/); 15 $cookie .= "Max-Age=0"; 16 } 17 18 if ($cookie =~ /Expires/i) { 19 # Set the "Expires" field to UNIX epoch 20 $cookie =~ s/Expires *= *[^;]+/Expires=Thu, 01 Jan 1970 00:00:00 GMT/i; 21 } else { 22 $cookie .= ";" unless ($cookie =~ m/;$/); 23 $cookie .= " " unless ($cookie =~ m/ $/); 24 $cookie .= "Expires=Thu, 01 Jan 1970 00:00:00 GMT"; 25 } 26 27 print "Set-Cookie: $cookie\n\n"; 28