• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/perl -wT
2use strict;
3
4print "Content-Type: text/plain\n";
5print "Cache-Control: no-store\n";
6print 'Cache-Control: no-cache="set-cookie"' . "\n";
7
8my $cookie = $ENV{"HTTP_CLEAR_COOKIE"};
9
10if ($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
18if ($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
27print "Set-Cookie: $cookie\n\n";
28