1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ruby 1.9 compat: cookies

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8405 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-12-15 02:28:53 +00:00
parent 2703d55935
commit 11dde5ca2f
2 changed files with 5 additions and 9 deletions

View file

@ -56,10 +56,6 @@ class CGI #:nodoc:
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 @@ class CGI #:nodoc:
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)

View file

@ -72,12 +72,12 @@ class CgiRequestTest < BaseCgiTest
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