diff options
-rw-r--r-- | lib/rack/session/abstract/id.rb | 3 | ||||
-rw-r--r-- | lib/rack/utils.rb | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/rack/session/abstract/id.rb b/lib/rack/session/abstract/id.rb index e9edeb7f..62bdb04b 100644 --- a/lib/rack/session/abstract/id.rb +++ b/lib/rack/session/abstract/id.rb @@ -310,7 +310,7 @@ module Rack end def force_options?(options) - options.values_at(:renew, :drop, :defer, :expire_after).any? + options.values_at(:max_age, :renew, :drop, :defer, :expire_after).any? end def security_matches?(env, options) @@ -347,6 +347,7 @@ module Rack cookie = Hash.new cookie[:value] = data cookie[:expires] = Time.now + options[:expire_after] if options[:expire_after] + cookie[:expires] = Time.now + options[:max_age] if options[:max_age] set_cookie(env, headers, cookie.merge!(options)) end diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb index 69a96eb9..42b2f5a0 100644 --- a/lib/rack/utils.rb +++ b/lib/rack/utils.rb @@ -267,9 +267,9 @@ module Rack def set_cookie_header!(header, key, value) case value when Hash - domain = "; domain=" + value[:domain] if value[:domain] - path = "; path=" + value[:path] if value[:path] - max_age = "; max-age=" + value[:max_age] if value[:max_age] + domain = "; domain=" + value[:domain] if value[:domain] + path = "; path=" + value[:path] if value[:path] + max_age = "; max-age=" + value[:max_age].to_s if value[:max_age] # There is an RFC mess in the area of date formatting for Cookies. Not # only are there contradicting RFCs and examples within RFC text, but # there are also numerous conflicting names of fields and partially |