diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-06-11 11:51:12 +0430 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-11 16:34:52 +0200 |
commit | edbb78d6cc3ec0ce4a73b765f7bb4b7c079c8a36 (patch) | |
tree | a69fbf719be0ebf583732311dbf828827faceb82 /actionpack/lib/action_dispatch/middleware/session | |
parent | 44830ead1c88e1c45124133ce3e2ed9f890f42de (diff) | |
download | rails-edbb78d6cc3ec0ce4a73b765f7bb4b7c079c8a36.tar.gz rails-edbb78d6cc3ec0ce4a73b765f7bb4b7c079c8a36.tar.bz2 rails-edbb78d6cc3ec0ce4a73b765f7bb4b7c079c8a36.zip |
The previous commit didn't work with complex domains, which is now fixed.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/session')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/session/abstract_store.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb index 040a83f7a6..0c4ceb5c39 100644 --- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb @@ -121,12 +121,12 @@ module ActionDispatch unless options[:expire_after].nil? cookie[:expires] = Time.now + options.delete(:expire_after) end - + if options[:domain] == :all - top_level_domain = env["HTTP_HOST"].split('.')[-2..-1].join('.') - options[:domain] = ".#{top_level_domain}" + env["HTTP_HOST"] =~ /^(.*\.)*(.*)\.(...|...\...|....|..\...)$/ + options[:domain] = ".#{$2}.#{$3}" end - + request = ActionDispatch::Request.new(env) set_cookie(request, cookie.merge!(options)) end |