Reputation: 43
I was wondering if there is any way of setting the session cookie (CGISESSID) attribute isSecure to true in Perl? I know at least in php it is easy to with:
ini_set('session.cookie_secure', 1);
Is there some similar way to do this in Perl?
Crossposted to Perlmonks.
Upvotes: 0
Views: 594
Reputation: 2341
assuming you use CGI::Cookie to build your cookie and $headers is a HTTP::Headers object you could use the following code:
require CGI::Cookie;
my $cookie = CGI::Cookie->new(
-name => 'testcookie', -value => 'testvalue', -secure => 1);
$headers->push_header(set_cookie => $cookie->as_string);
+- typos
HTH
Upvotes: 2