From 781985f7f229eb665b3eed693eb9642caebc44a0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 25 Feb 2007 16:35:24 +0000 Subject: 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 --- actionpack/lib/action_controller/session/cookie_store.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/session/cookie_store.rb') 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 -- cgit v1.2.3