move serialization option from cookie option to global env option

This commit is contained in:
Greg Ose
2014-06-17 11:54:35 -05:00
committed by Charlie Somerville
parent b09eac885e
commit f6844fc683
2 changed files with 4 additions and 11 deletions

View File

@@ -81,6 +81,7 @@ module ActionDispatch
class Cookies
HTTP_HEADER = "Set-Cookie".freeze
TOKEN_KEY = "action_dispatch.secret_token".freeze
SESSION_SERIALIZER = "action_dispatch.session_serializer".freeze
# Raised when storing more than 4K of session data.
class CookieOverflow < StandardError; end
@@ -106,12 +107,7 @@ module ActionDispatch
secret = request.env[TOKEN_KEY]
host = request.host
secure = request.ssl?
serializer = if session_options = request.env[Session::AbstractStore::ENV_SESSION_OPTIONS_KEY]
session_options[:serializer]
else
nil
end
byebug unless serializer
serializer = request.env[SESSION_SERIALIZER]
new(secret, host, secure, serializer).tap do |hash|
hash.update(request.cookies)
@@ -164,10 +160,6 @@ module ActionDispatch
# if host matches one of the supplied domains without a dot in front of it
options[:domain] = options[:domain].find {|domain| @host.include? domain[/^\.?(.*)$/, 1] }
end
@serializer = options[:serializer]
byebug unless @serializer
end
# Sets the cookie named +name+. The second argument may be the very cookie