diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-02-25 16:35:24 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-02-25 16:35:24 +0000 |
commit | 781985f7f229eb665b3eed693eb9642caebc44a0 (patch) | |
tree | b87cd67949c03e89af269652622a73589d027224 /actionpack/lib/action_controller/session | |
parent | c9770d8a5ac1c477943ba431396e5d7e6b7389b0 (diff) | |
download | rails-781985f7f229eb665b3eed693eb9642caebc44a0.tar.gz rails-781985f7f229eb665b3eed693eb9642caebc44a0.tar.bz2 rails-781985f7f229eb665b3eed693eb9642caebc44a0.zip |
Cookie session store: empty and unchanged sessions don't write a cookie.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6226 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/session')
-rw-r--r-- | actionpack/lib/action_controller/session/cookie_store.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/session/cookie_store.rb b/actionpack/lib/action_controller/session/cookie_store.rb index 8763a4933a..1754eb34b1 100644 --- a/actionpack/lib/action_controller/session/cookie_store.rb +++ b/actionpack/lib/action_controller/session/cookie_store.rb @@ -65,7 +65,7 @@ class CGI::Session::CookieStore # Write the session data cookie if it was loaded and has changed. def close - if defined? @data + if defined?(@data) && !@data.blank? updated = marshal(@data) raise CookieOverflow if updated.size > MAX write_cookie('value' => updated) unless updated == @original @@ -74,6 +74,7 @@ class CGI::Session::CookieStore # Delete the session data by setting an expired cookie with no data. def delete + @data = nil write_cookie('value' => '', 'expires' => 1.year.ago) end |