]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/cookies.cgi
use /var/log/apache2/ as the default error log location
[debbugs.git] / cgi / cookies.cgi
index 370b0bcf87435c873a480f02a841814ea0e3da33..20a98101e56278c3afe673951856b1e980c532cb 100644 (file)
@@ -4,9 +4,12 @@ use strict;
 use POSIX qw(strftime);
 require './common.pl';
 
-$ENV{"HTTP_COOKIES"} = "";
+my $oldcookies = $ENV{"HTTP_COOKIE"};
+$ENV{"HTTP_COOKIE"} = "";
 my %param = readparse();
 
+my %oldcookies = map { ($1, $2) if (m/(.*)=(.*)/) } split /[;&]/, $oldcookies;
+
 my $clear = (defined $param{"clear"} && $param{"clear"} eq "yes");
 my @time_now = gmtime(time());
 my $time_future = strftime("%a, %d-%b-%Y %T GMT",
@@ -14,7 +17,7 @@ my $time_future = strftime("%a, %d-%b-%Y %T GMT",
 my $time_past = strftime("%a, %d-%b-%Y %T GMT",
                        59, 59, 23, 31, 11, $time_now[5]-10);
 
-my @cookie_options = qw(repeatmerged terse reverse trim);
+my @cookie_options = qw(repeatmerged terse reverse trim oldview);
 
 print "Content-Type: text/html; charset=utf-8\n";
 
@@ -28,13 +31,15 @@ for my $c (@cookie_options) {
     }
 }
 print "\n";
+print "<p>Oldcookies  $oldcookies  .\n";
 print "<p>Cookies set!\n";
 for my $c (@cookie_options) {
+    my $old = $oldcookies{$c} || "unset";
     if (defined $param{$c}) {
-        printf "<br>Set %s=%s\n", $c, $param{$c};
+        printf "<br>Set %s=%s (was %s)\n", $c, $param{$c}, $old;
     } elsif ($clear) {
-        printf "<br>Cleared %s\n", $c;
+        printf "<br>Cleared %s (was %s)\n", $c, $old;
     } else {
-        printf "<br>Didn't touch %s (use clear=yes to clear)\n", $c;
+        printf "<br>Didn't touch %s (was %s; use clear=yes to clear)\n", $c, $old;
     }
 }