All pastes #578857 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-20 12:25 UTC
rendered paste body
sub go {
  my $self=shift;
  my $sid=$self->query->cookie('CGISESSID');
  $self->session(new CGI::Session("driver:MySQL", $sid, {Handle=>$self->db->dbh}));
  my $cookie = $self->query->cookie(CGISESSID=>$self->session->id);
  if (!$sid) {
    print (STDERR "No cookie, setting cookie and forwarding to cookiechecker\n");
    print $self->query->redirect(-location=>"/checkCookies.fcgi",-cookie=>$cookie);
  } elsif ($sid ne $self->session->id) {
    print (STDERR "sid doesn't match session id, setting cookie and sending to login\n");
    $self->cookie($cookie);
    $self->login;
  } elsif ($self->session->param('loggedIn') != 1) {
    print (STDERR "loggedIn not set to 1, sending to login\n");
    $self->login;
  } else {
    print (STDERR "looking good, sending to action\n");
    $self->action;
  }
}

changing line 4 from:
$self->session(new CGI::Session("driver:MySQL", undef, {Handle=>$self->db->dbh}));
to
$self->session(new CGI::Session("driver:MySQL", $sid, {Handle=>$self->db->dbh}));
stopped the "reuse" of the cgi object but I'm not sure why