Don't bother copying X-Cake to Cookie if it's empty.
authorMike Taylor <mike@indexdata.com>
Wed, 26 Jun 2013 13:03:54 +0000 (15:03 +0200)
committerMike Taylor <mike@indexdata.com>
Wed, 26 Jun 2013 13:03:54 +0000 (15:03 +0200)
etc/mod_perl/MyApache2/CopyCookie.pm

index 86e9b69..10b1b10 100644 (file)
@@ -26,8 +26,10 @@ sub handler {
     $cookie = $hi->get('Cookie');
     if (!defined $cookie || $cookie eq "") {
        $cookie = $hi->get('X-Cake');
-       warn "copying X-Cake '$cookie' to Cookie";
-       $hi->set('Cookie', $cookie);
+       if (defined $cookie && $cookie ne "") {
+           warn "copying X-Cake '$cookie' to Cookie";
+           $hi->set('Cookie', $cookie);
+       }
     }
 
     while ($f->read(my $buffer, BUFF_LEN)) {