Permalink
Browse files

Ruby 1.9 compat: cookies

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8405 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 2703d55 commit 11dde5ca2fc81a785fd5234f8aeb2e7f98980939 @jeremy jeremy committed Dec 15, 2007
Showing with 5 additions and 9 deletions.
  1. +1 −5 actionpack/lib/action_controller/cgi_ext/cookie.rb
  2. +4 −4 actionpack/test/controller/cgi_test.rb
@@ -56,10 +56,6 @@ def initialize(name = '', *value)
super(@value)
end
- def __setobj__(obj)
- @_dc_obj = obj
- end
-
# Set whether the Cookie is a secure cookie or not.
def secure=(val)
@secure = val == true
@@ -93,7 +89,7 @@ def self.parse(raw_cookie)
cookies = Hash.new([])
if raw_cookie
- raw_cookie.split(/; ?/).each do |pairs|
+ raw_cookie.split(/[;,]\s?/).each do |pairs|
name, values = pairs.split('=',2)
next unless name and values
name = CGI::unescape(name)
@@ -72,12 +72,12 @@ def test_host_if_ipv6_reference_with_port
def test_cookie_syntax_resilience
cookies = CGI::Cookie::parse(@request_hash["HTTP_COOKIE"]);
- assert_equal ["c84ace84796670c052c6ceb2451fb0f2"], cookies["_session_id"]
- assert_equal ["yes"], cookies["is_admin"]
+ assert_equal ["c84ace84796670c052c6ceb2451fb0f2"], cookies["_session_id"], cookies.inspect
+ assert_equal ["yes"], cookies["is_admin"], cookies.inspect
alt_cookies = CGI::Cookie::parse(@alt_cookie_fmt_request_hash["HTTP_COOKIE"]);
- assert_equal ["c84ace84796670c052c6ceb2451fb0f2"], alt_cookies["_session_id"]
- assert_equal ["yes"], alt_cookies["is_admin"]
+ assert_equal ["c84ace84796670c052c6ceb2451fb0f2"], alt_cookies["_session_id"], alt_cookies.inspect
+ assert_equal ["yes"], alt_cookies["is_admin"], alt_cookies.inspect
end
end

0 comments on commit 11dde5c

Please sign in to comment.