in t/modules/session.t [49:84]
sub check_result
{
my $name = shift;
my $res = shift;
my $session = shift // '(none)';
my $dirty = shift // 0;
my $expiry = shift // 0;
my $response = shift // '';
ok t_cmp($res->code, 200, "response code ($name)");
my $gotSession = $res->header('X-Test-Session') // '(none)';
my $sessionData = $gotSession;
if ($gotSession =~ /^(?:(.+)&)?expiry=([0-9]+)(?:&(.*))?$/i) {
# Don't use math ops, $2 is too big for 32 Bit Perl
# Use stripping of trailing "0"s instead
my $gotExpiry = substr($2, 0, -1 * (length(APR_TIME_PER_SEC) - 1));
t_debug "expiry of $gotExpiry ($name)";
ok $expiry && time() < $gotExpiry;
# Combine the remaining data (if there is any) without the expiry.
$sessionData = join('&', grep(defined, ($1, $3)));
}
else {
t_debug "no expiry ($name)";
ok !$expiry;
}
ok t_cmp($sessionData, $session, "session header ($name)");
my $got = $res->header('X-Test-Session-Dirty') // 0;
ok t_cmp($got, $dirty, "session dirty ($name)");
$got = $res->content;
chomp($got);
ok t_cmp($got, $response, "body ($name)");
return $gotSession;
}