diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-26 18:27:41 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-26 18:27:41 -0700 |
commit | f5b4a9d02bc2292bae59e7b4fc028cce6edb91f7 (patch) | |
tree | 10436b421b436153fb1a68829b0df6dabe6f1858 /actionpack | |
parent | 1850aea7fc9a1353de8e87adadf5230269b358c1 (diff) | |
download | rails-f5b4a9d02bc2292bae59e7b4fc028cce6edb91f7.tar.gz rails-f5b4a9d02bc2292bae59e7b4fc028cce6edb91f7.tar.bz2 rails-f5b4a9d02bc2292bae59e7b4fc028cce6edb91f7.zip |
Array splitting strings on newlines is deprecated
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index c2add1272e..6c92fb9713 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -245,9 +245,14 @@ module ActionDispatch # :nodoc: # assert_equal 'AuthorOfNewPage', r.cookies['author'] def cookies cookies = {} - Array(headers['Set-Cookie']).each do |cookie| - key, value = cookie.split(";").first.split("=").map { |v| Rack::Utils.unescape(v) } - cookies[key] = value + if header = headers['Set-Cookie'] + header = header.split("\n") if header.respond_to?(:to_str) + header.each do |cookie| + if pair = cookie.split(';').first + key, value = pair.split("=").map { |v| Rack::Utils.unescape(v) } + cookies[key] = value + end + end end cookies end @@ -305,7 +310,13 @@ module ActionDispatch # :nodoc: end def convert_cookies! - headers['Set-Cookie'] = Array(headers['Set-Cookie']).compact + headers['Set-Cookie'] = + if header = headers['Set-Cookie'] + header = header.split("\n") if header.respond_to?(:to_str) + header.compact + else + [] + end end end end |