Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. my $secure_cookie = 1;
  2. $secure_cookie = 0 if (not defined $ENV{HTTP_HOST} or $ENV{HTTP_HOST} =~ m/localhost/);
  3. if ($ENV{HTTPS} eq 'on' or $ENV{HTTP_X_REQUEST_PROTOCOL} eq 'https' or not defined $ENV{HTTP_HOST} or $ENV{HTTP_HOST} =~ m/localhost/) {
  4. CGI::Cookie->new(-name=>'SESSION_ID', -value=>$session->{_session_id}, -secure=>$secure_cookie)->bake;
  5. # But, if they aren't on HTTPS, keep them logged out.
  6. } else {
  7. CGI::Cookie->new(-name=>'SESSION_ID', -value=>0, -secure=>$secure_cookie)->bake;
  8. }
  9. $session->{__counter__} = $session->{__counter__}+1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement