Apache-Session-Counted
view release on metacpan or search on metacpan
lib/Apache/Session/Counted.pm view on Meta::CPAN
}
$c = File::CounterFile->new($cf,"0");
}
warn "A:S:Counted: Counterfile problem successfully reapired.";
}
my $rhexid = sprintf "%08x", $c->inc;
my $hexid = scalar reverse $rhexid; # optimized for treestore. Not
# everything in one directory
# we have entropy as bad as rand(). Typically not very good.
my $password = sprintf "%08x%08x", rand(0xffffffff), rand(0xffffffff);
if (exists $self->{args}{HostID}) {
return sprintf "%s:%s_%s", $self->{args}{HostID}, $hexid, $password;
} else {
return $hexid . "_" . $password;
}
}
1;
=head1 NAME
Apache::Session::Counted - Session management via a File::CounterFile
=head1 SYNOPSIS
lib/Apache/Session/Counted.pm view on Meta::CPAN
the session (if you retrieved a session at all). So you have to make
sure that you send your users a new session-id in each response, and
that this is never the old one.
As an implemenation detail it may be of interest to you, that the
session ID in Apache::Session::Counted consists of two or three parts:
an optional host alias given by the HostID paramter, followed by a
colon. Then an ordinary number which is a simple counter which is
followed by an underscore. And finally a session-ID like the one in
Apache::Session. The number part is used as an identifier of the
session and the ID part is used as a password. The number part is
easily predictable, but the second part is reasonable unpredictable.
We use the first part for implementation details like storage on the
disk and the second part to verify the ownership of that token.
=head1 PREREQUISITES
Apache::Session::Counted needs Apache::Session and File::CounterFile,
all available from the CPAN. The HostID and HostURL parameters for a
cluster solution need LWP installed.
( run in 0.261 second using v1.01-cache-2.11-cpan-26ccb49234f )