mirror of
https://github.com/github/rails.git
synced 2026-01-08 06:13:56 -05:00
move serialization option from cookie option to global env option
This commit is contained in:
committed by
Charlie Somerville
parent
b09eac885e
commit
f6844fc683
@@ -81,6 +81,7 @@ module ActionDispatch
|
|||||||
class Cookies
|
class Cookies
|
||||||
HTTP_HEADER = "Set-Cookie".freeze
|
HTTP_HEADER = "Set-Cookie".freeze
|
||||||
TOKEN_KEY = "action_dispatch.secret_token".freeze
|
TOKEN_KEY = "action_dispatch.secret_token".freeze
|
||||||
|
SESSION_SERIALIZER = "action_dispatch.session_serializer".freeze
|
||||||
|
|
||||||
# Raised when storing more than 4K of session data.
|
# Raised when storing more than 4K of session data.
|
||||||
class CookieOverflow < StandardError; end
|
class CookieOverflow < StandardError; end
|
||||||
@@ -106,12 +107,7 @@ module ActionDispatch
|
|||||||
secret = request.env[TOKEN_KEY]
|
secret = request.env[TOKEN_KEY]
|
||||||
host = request.host
|
host = request.host
|
||||||
secure = request.ssl?
|
secure = request.ssl?
|
||||||
serializer = if session_options = request.env[Session::AbstractStore::ENV_SESSION_OPTIONS_KEY]
|
serializer = request.env[SESSION_SERIALIZER]
|
||||||
session_options[:serializer]
|
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
byebug unless serializer
|
|
||||||
|
|
||||||
new(secret, host, secure, serializer).tap do |hash|
|
new(secret, host, secure, serializer).tap do |hash|
|
||||||
hash.update(request.cookies)
|
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
|
# 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] }
|
options[:domain] = options[:domain].find {|domain| @host.include? domain[/^\.?(.*)$/, 1] }
|
||||||
end
|
end
|
||||||
|
|
||||||
@serializer = options[:serializer]
|
|
||||||
byebug unless @serializer
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets the cookie named +name+. The second argument may be the very cookie
|
# Sets the cookie named +name+. The second argument may be the very cookie
|
||||||
|
|||||||
@@ -181,7 +181,8 @@ module Rails
|
|||||||
"action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions,
|
"action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions,
|
||||||
"action_dispatch.show_detailed_exceptions" => config.consider_all_requests_local,
|
"action_dispatch.show_detailed_exceptions" => config.consider_all_requests_local,
|
||||||
"action_dispatch.logger" => Rails.logger,
|
"action_dispatch.logger" => Rails.logger,
|
||||||
"action_dispatch.backtrace_cleaner" => Rails.backtrace_cleaner
|
"action_dispatch.backtrace_cleaner" => Rails.backtrace_cleaner,
|
||||||
|
"action_dispatch.session_serializer" => config.session_options[:serializer],
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user