Skip to content

Commit

Permalink
hint at life cycle of stash and session
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 3, 2014
1 parent 1c89077 commit b463eeb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Changes
Expand Up @@ -3094,7 +3094,7 @@
- Optimized buffering a bit.
- Fixed a case where multiple clients would taint the shared ioloop.
(ferreira)
- Fixed a case where non existing actions were considered a server error.
- Fixed a case where non-existing actions were considered a server error.
(Andre Vieth)

0.999901 2009-09-01
Expand Down Expand Up @@ -3126,7 +3126,7 @@
- Fixed a few cases where exceptions and not found events would result in
empty pages.
- Fixed layouts with partial templates.
- Fixed encoding of non utf8 form-data.
- Fixed encoding of non-utf8 form-data.
- Fixed body callbacks to get automatic buffering.
- Fixed a case where Mojo::Server::Daemon and Mojo::Client were too
defensive and made them in turn 20 times faster.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Prefork.pm
Expand Up @@ -186,7 +186,7 @@ sub _spawn {
} or $lock = $@ eq "alarm\n" ? 0 : die $@;
}

# Non blocking
# Non-blocking
else { $lock = flock $handle, LOCK_EX | LOCK_NB }

return $lock;
Expand Down
20 changes: 11 additions & 9 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -865,9 +865,10 @@ timeout, which usually defaults to C<15> seconds.
$c = $c->session({foo => 'bar'});
$c = $c->session(foo => 'bar');
Persistent data storage, all session data gets serialized with L<Mojo::JSON>
and stored C<Base64> encoded in C<HMAC-SHA1> signed cookies. Note that cookies
usually have a 4096 byte limit, depending on browser.
Persistent data storage for the next few requests, all session data gets
serialized with L<Mojo::JSON> and stored C<Base64> encoded in C<HMAC-SHA1>
signed cookies. Note that cookies usually have a 4096 byte limit, depending on
browser.
# Manipulate session
$c->session->{foo} = 'bar';
Expand Down Expand Up @@ -901,12 +902,13 @@ discarded.
$c = $c->stash({foo => 'bar'});
$c = $c->stash(foo => 'bar');
Non persistent data storage and exchange, application wide default values can
be set with L<Mojolicious/"defaults">. Some stash values have a special
meaning and are reserved, the full list is currently C<action>, C<app>, C<cb>,
C<controller>, C<data>, C<extends>, C<format>, C<handler>, C<json>, C<layout>,
C<namespace>, C<partial>, C<path>, C<status>, C<template> and C<text>. Note
that all stash values with a C<mojo.*> prefix are reserved for internal use.
Non-persistent data storage and exchange for the current request, application
wide default values can be set with L<Mojolicious/"defaults">. Some stash
values have a special meaning and are reserved, the full list is currently
C<action>, C<app>, C<cb>, C<controller>, C<data>, C<extends>, C<format>,
C<handler>, C<json>, C<layout>, C<namespace>, C<partial>, C<path>, C<status>,
C<template> and C<text>. Note that all stash values with a C<mojo.*> prefix
are reserved for internal use.
# Remove value
my $foo = delete $c->stash->{foo};
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/daemon.t
Expand Up @@ -110,15 +110,15 @@ ok $tx->kept_alive, 'was kept alive';
is $tx->res->code, 200, 'right status';
is $tx->res->body, 'Whatever!', 'right content';

# Non keep-alive request
# Non-keep-alive request
$tx = $ua->get('/close/' => {Connection => 'close'});
ok !$tx->keep_alive, 'will not be kept alive';
ok $tx->kept_alive, 'was kept alive';
is $tx->res->code, 200, 'right status';
is $tx->res->headers->connection, 'close', 'right "Connection" value';
is $tx->res->body, 'Whatever!', 'right content';

# Second non keep-alive request
# Second non-keep-alive request
$tx = $ua->get('/close/' => {Connection => 'close'});
ok !$tx->keep_alive, 'will not be kept alive';
ok !$tx->kept_alive, 'was not kept alive';
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/user_agent_online.t
Expand Up @@ -131,7 +131,7 @@ is_deeply \@kept_alive, [1, 1, 1], 'connections kept alive';
# Fresh user agent again
$ua = Mojo::UserAgent->new;

# Custom non keep-alive request
# Custom non-keep-alive request
$tx = Mojo::Transaction::HTTP->new;
$tx->req->method('GET');
$tx->req->url->parse('http://metacpan.org');
Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/lib/MojoliciousTest.pm
Expand Up @@ -88,7 +88,7 @@ sub startup {
# /somethingtest (refer to another route with url_for)
$r->route('/somethingtest')->to('foo#something');

# /something_missing (refer to a non existing route with url_for)
# /something_missing (refer to a non-existing route with url_for)
$r->route('/something_missing')->to('foo#url_for_missing');

# /test3 (no class, just a namespace)
Expand Down

0 comments on commit b463eeb

Please sign in to comment.