Apache2-ClickPath
view release on metacpan or search on metacpan
lib/Apache2/ClickPath/Store.pm view on Meta::CPAN
=item B<500> Server Error
this indicates a configuration error. Maybe the data directory doesn't exist
or is not writeable.
=item B<400> Bad Request
an invalid key or session identifier was used.
=item B<404> Not Found
the data item identified by the combination of session and key was not found.
If the item had once existed then it was possibly hit by a timeout.
=back
=head1 CONFIGURATION
C<Apache2::ClickPath::Store> is loaded with a C<PerlLoadModule> directive and
then configured with the following directives. At least
t/session/011store.t view on Meta::CPAN
ok t_cmp( $res->code, 200, 'set returns code 200' );
ok t_cmp( t_read_file( "t/store/$session/klaus" ), 'value',
'value stored' );
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->content, 'value', 'get stored value' );
ok t_cmp( $res->code, 200, 'get returns code 200' );
$res=GET( "/store?a=get;s=$session;k=otto" );
ok t_cmp( $res->code, 404, 'get returns code 404' );
Apache::TestRequest::user_agent( reset=>1, keep_alive=>300 );
$res=GET( "/store?a=get;s=$session;k=klaus" );
sleep 3;
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->code, 200, 'no timeout yet' );
sleep 3;
Apache::TestRequest::user_agent( reset=>1, keep_alive=>0 );
sleep 1;
ok t_cmp( -d "t/store/#$session", 1, 'session marked for deletion (renamed)' );
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->code, 404, 'data not accessible' );
sleep 3;
$res=GET( "/store?a=get;s=$session;k=klaus" ); # let cleanup() run once again
sleep 1; # and give it time to accomplish the task
$res=GET( "/store?a=get;s=$session;k=klaus" );
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->code, 404, 'session store deleted => NOT_FOUND' );
ok t_cmp( -d "t/store/#$session", undef, 'session directory deleted' );
Apache::TestRequest::user_agent( reset=>1 ); # close the kept alive connection
Apache::TestRequest::module('Secret');
$session=GET_BODY( "/TestSession__001session_generation?SESSION" );
$session=~s/SESSION=//; chomp( $session );
t_debug( "using session $session" );
t/session/011store.t view on Meta::CPAN
ok t_cmp( $res->code, 200, 'set returns code 200 (Secret)' );
ok t_cmp( t_read_file( "t/store/$session/klaus" ), 'value',
'value stored (Secret)' );
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->content, 'value', 'get stored value (Secret)' );
ok t_cmp( $res->code, 200, 'get returns code 200 (Secret)' );
$res=GET( "/store?a=get;s=$session;k=otto" );
ok t_cmp( $res->code, 404, 'get returns code 404 (Secret)' );
Apache::TestRequest::user_agent( reset=>1, keep_alive=>300 );
$res=GET( "/store?a=get;s=$session;k=klaus" );
sleep 3;
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->code, 200, 'no timeout yet (Secret)' );
sleep 3;
Apache::TestRequest::user_agent( reset=>1, keep_alive=>0 );
sleep 1;
ok t_cmp( -d "t/store/#$session", 1,
'session marked for deletion (renamed) (Secret)' );
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->code, 404, 'data not accessible (Secret)' );
sleep 2;
$res=GET( "/store?a=get;s=$session;k=klaus" ); # let cleanup() run once again
sleep 1; # and give it time to accomplish the task
$res=GET( "/store?a=get;s=$session;k=klaus" );
ok t_cmp( $res->code, 404, 'session store deleted => NOT_FOUND (Secret)' );
ok t_cmp( -d "t/store/#$session", undef,
'session directory deleted (Secret)' );
Apache::TestRequest::user_agent( reset=>1 ); # close the kept alive connection
sleep 3; # and give the server time to cleanup and
# prevent a warning if t/store is removed
# before the server has finished it's cleanup
# Local Variables: #
# mode: cperl #
( run in 1.320 second using v1.01-cache-2.11-cpan-39bf76dae61 )