lib/rack/session/abstract/id.rb in rack-1.3.0 vs lib/rack/session/abstract/id.rb in rack-1.3.1
- old
+ new
@@ -212,19 +212,21 @@
if secure
SecureRandom.hex(@sid_length)
else
"%0#{@sid_length}x" % Kernel.rand(2**@sidbits - 1)
end
- rescue NotImpelentedError
+ rescue NotImplementedError
generate_sid(false)
end
# Sets the lazy session at 'rack.session' and places options and session
# metadata into 'rack.session.options'.
def prepare_session(env)
- env[ENV_SESSION_KEY] = SessionHash.new(self, env)
+ session_was = env[ENV_SESSION_KEY]
+ env[ENV_SESSION_KEY] = SessionHash.new(self, env)
env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options)
+ env[ENV_SESSION_KEY].merge! session_was if session_was
end
# Extracts the session id from provided cookies and passes it and the
# environment to #get_session.