4 use POSIX qw(strftime);
7 my $oldcookies = $ENV{"HTTP_COOKIE"};
8 $ENV{"HTTP_COOKIE"} = "";
9 my %param = readparse();
11 my %oldcookies = map { ($1, $2) if (m/(.*)=(.*)/) } split /[;&]/, $oldcookies;
13 my $clear = (defined $param{"clear"} && $param{"clear"} eq "yes");
14 my @time_now = gmtime(time());
15 my $time_future = strftime("%a, %d-%b-%Y %T GMT",
16 59, 59, 23, 31, 11, $time_now[5]+10);
17 my $time_past = strftime("%a, %d-%b-%Y %T GMT",
18 59, 59, 23, 31, 11, $time_now[5]-10);
20 my @cookie_options = qw(repeatmerged terse reverse trim oldview);
22 print "Content-Type: text/html; charset=utf-8\n";
24 for my $c (@cookie_options) {
25 if (defined $param{$c}) {
26 printf "Set-Cookie: %s=%s; expires=%s; domain=%s; path=/\n",
27 $c, $param{$c}, $time_future, "bugs.debian.org";
29 printf "Set-Cookie: %s=%s; expires=%s; domain=%s; path=/\n",
30 $c, "", $time_past, "bugs.debian.org";
34 print "<p>Oldcookies $oldcookies .\n";
35 print "<p>Cookies set!\n";
36 for my $c (@cookie_options) {
37 my $old = $oldcookies{$c} || "unset";
38 if (defined $param{$c}) {
39 printf "<br>Set %s=%s (was %s)\n", $c, $param{$c}, $old;
41 printf "<br>Cleared %s (was %s)\n", $c, $old;
43 printf "<br>Didn't touch %s (was %s; use clear=yes to clear)\n", $c, $old;