public
Rubygem
Fork of wycats/merb-core
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/reframeit/merb-core.git
honor cookie domain when setting and deleting cookies
Matthew Windwer (author)
Wed Jul 30 11:42:02 -0700 2008
commit  2206d1a5cce8114c80403912a5f3b77897ae96a0
tree    99b2f3f55b2e4d601348df8a98812ac19bf49afe
parent  4813273a78309d0578c4b9d208acf9b221899b01
...
64
65
66
 
 
 
67
68
69
...
80
81
82
 
 
 
83
84
85
...
64
65
66
67
68
69
70
71
72
...
83
84
85
86
87
88
89
90
91
0
@@ -64,6 +64,9 @@ module Merb
0
     def delete(name, options = {})
0
       cookie = @_cookies.delete(name)
0
       options = Mash.new(options)
0
+      if domain = options[:domain] || Merb::Controller._session_cookie_domain
0
+        options[:domain] = domain
0
+      end
0
       options[:expires] = Time.at(0)
0
       set_cookie(name, "", options)
0
       Merb.logger.info("Cookie deleted: #{name} => #{cookie.inspect}")
0
@@ -80,6 +83,9 @@ module Merb
0
     # :expires<Time>:: Cookie expiry date.
0
     def set_cookie(name, value, options)
0
       options[:path] = '/' unless options[:path]
0
+      if domain = options[:domain] || Merb::Controller._session_cookie_domain
0
+        options[:domain] = domain
0
+      end
0
       if expiry = options[:expires]
0
         options[:expires] = expiry.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)
0
       end

Comments