diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-05 17:59:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-05 17:59:28 -0700 |
commit | de6b43bfd142c6d96548a0bdf53b8f0bc5702343 (patch) | |
tree | ef29799a760f52ff728dd14635bc76edead56ca7 /actionpack | |
parent | e6074a35412b85c4c27a7d8063c68370617e3daa (diff) | |
download | rails-de6b43bfd142c6d96548a0bdf53b8f0bc5702343.tar.gz rails-de6b43bfd142c6d96548a0bdf53b8f0bc5702343.tar.bz2 rails-de6b43bfd142c6d96548a0bdf53b8f0bc5702343.zip |
sop passing host and secure to the build method
eventually we will make the cookie jar derive these values from the
request object rather than save a reference to the values
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/testing/test_process.rb | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index b654078b66..a9c7419aae 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -8,7 +8,7 @@ require 'active_support/json' module ActionDispatch class Request < Rack::Request def cookie_jar - env['action_dispatch.cookies'] ||= Cookies::CookieJar.build(self, host, ssl?, cookies) + env['action_dispatch.cookies'] ||= Cookies::CookieJar.build(self, cookies) end def key_generator @@ -254,8 +254,10 @@ module ActionDispatch # $& => example.local DOMAIN_REGEXP = /[^.]*\.([^.]*|..\...|...\...)$/ - def self.build(req, host, secure, cookies) + def self.build(req, cookies) key_generator = req.key_generator + host = req.host + secure = req.ssl? new(key_generator, host, secure, req).tap do |hash| hash.update(cookies) end diff --git a/actionpack/lib/action_dispatch/testing/test_process.rb b/actionpack/lib/action_dispatch/testing/test_process.rb index c410d36a1e..c28d701b48 100644 --- a/actionpack/lib/action_dispatch/testing/test_process.rb +++ b/actionpack/lib/action_dispatch/testing/test_process.rb @@ -19,7 +19,7 @@ module ActionDispatch end def cookies - @cookie_jar ||= Cookies::CookieJar.build(@request, @request.host, @request.ssl?, @request.cookies) + @cookie_jar ||= Cookies::CookieJar.build(@request, @request.cookies) end def redirect_to_url |