Permalink
Browse files

Make sure we get a valid empty session hash in all cases.

darcs-hash:20070312160400-111e0-f672ea2146577e1ac75ffb0e625f3560677a6a6f.gz
  • Loading branch information...
chneukirchen committed Mar 12, 2007
1 parent e276c2d commit 9f5583691f3543c7e0530e9c4cf080c27b497c4d
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/rack/session/cookie.rb
@@ -39,13 +39,14 @@ def load_session(env)
request = Rack::Request.new(env)
session_data = request.cookies[@key]
- if session_data.nil?
- env["rack.session"] = Hash.new
- else
+ begin
session_data = Base64.decode64(session_data)
session_data = Marshal.load(session_data)
env["rack.session"] = session_data
+ rescue
+ env["rack.session"] = Hash.new
end
+
env["rack.session.options"] = @default_options.dup
end

0 comments on commit 9f55836

Please sign in to comment.