1 |
graaff 10/06/04 13:37:32 |
2 |
|
3 |
Added: actionpack-2.3.8-custom-cookie-fix.patch |
4 |
Log: |
5 |
Fix problems with sessions in integration tests according to https://rails.lighthouseapp.com/projects/8994/tickets/4743-session-cookie-breaks-if-used-with-custom-cookie-in-rails-238 |
6 |
(Portage version: 2.1.8.3/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-ruby/actionpack/files/actionpack-2.3.8-custom-cookie-fix.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-ruby/actionpack/files/actionpack-2.3.8-custom-cookie-fix.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-ruby/actionpack/files/actionpack-2.3.8-custom-cookie-fix.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: actionpack-2.3.8-custom-cookie-fix.patch |
15 |
=================================================================== |
16 |
From 09e81c7069341ab219ddbd74817feea4a09b8172 Mon Sep 17 00:00:00 2001 |
17 |
From: Jesse Storimer <jstorimer@×××××.com> |
18 |
Date: Tue, 1 Jun 2010 08:35:25 -0400 |
19 |
Subject: [PATCH] CookieStore should preserve the Set-Cookie header Array [#4743 state:resolved] |
20 |
|
21 |
--- |
22 |
.../lib/action_controller/session/cookie_store.rb | 7 ++----- |
23 |
.../test/controller/session/cookie_store_test.rb | 18 ++++++++++++++++-- |
24 |
2 files changed, 18 insertions(+), 7 deletions(-) |
25 |
|
26 |
diff --git a/actionpack/lib/action_controller/session/cookie_store.rb b/actionpack/lib/action_controller/session/cookie_store.rb |
27 |
index 3d21e81..2fcee56 100644 |
28 |
--- a/actionpack/lib/action_controller/session/cookie_store.rb |
29 |
+++ b/actionpack/lib/action_controller/session/cookie_store.rb |
30 |
@@ -114,11 +114,8 @@ module ActionController |
31 |
end |
32 |
|
33 |
cookie = build_cookie(@key, cookie.merge(options)) |
34 |
- unless headers[HTTP_SET_COOKIE].blank? |
35 |
- headers[HTTP_SET_COOKIE] << "\n#{cookie}" |
36 |
- else |
37 |
- headers[HTTP_SET_COOKIE] = cookie |
38 |
- end |
39 |
+ headers[HTTP_SET_COOKIE] = [] if headers[HTTP_SET_COOKIE].blank? |
40 |
+ headers[HTTP_SET_COOKIE] << cookie |
41 |
end |
42 |
|
43 |
[status, headers, body] |
44 |
diff --git a/actionpack/test/controller/session/cookie_store_test.rb b/actionpack/test/controller/session/cookie_store_test.rb |
45 |
index 5ef8eec..02e9ed2 100644 |
46 |
--- a/actionpack/test/controller/session/cookie_store_test.rb |
47 |
+++ b/actionpack/test/controller/session/cookie_store_test.rb |
48 |
@@ -44,6 +44,12 @@ class CookieStoreTest < ActionController::IntegrationTest |
49 |
head :ok |
50 |
end |
51 |
|
52 |
+ def set_session_value_and_cookie |
53 |
+ cookies["foo"] = "bar" |
54 |
+ session[:foo] = "bar" |
55 |
+ render :text => Rack::Utils.escape(Verifier.generate(session.to_hash)) |
56 |
+ end |
57 |
+ |
58 |
def rescue_action(e) raise end |
59 |
end |
60 |
|
61 |
@@ -96,7 +102,7 @@ class CookieStoreTest < ActionController::IntegrationTest |
62 |
with_test_route_set do |
63 |
get '/set_session_value' |
64 |
assert_response :success |
65 |
- assert_equal "_myapp_session=#{response.body}; path=/; HttpOnly", |
66 |
+ assert_equal ["_myapp_session=#{response.body}; path=/; HttpOnly"], |
67 |
headers['Set-Cookie'] |
68 |
end |
69 |
end |
70 |
@@ -164,7 +170,7 @@ class CookieStoreTest < ActionController::IntegrationTest |
71 |
get '/set_session_value' |
72 |
assert_response :success |
73 |
session_payload = response.body |
74 |
- assert_equal "_myapp_session=#{response.body}; path=/; HttpOnly", |
75 |
+ assert_equal ["_myapp_session=#{response.body}; path=/; HttpOnly"], |
76 |
headers['Set-Cookie'] |
77 |
|
78 |
get '/call_reset_session' |
79 |
@@ -193,6 +199,14 @@ class CookieStoreTest < ActionController::IntegrationTest |
80 |
end |
81 |
end |
82 |
|
83 |
+ def test_setting_session_value_and_cookie |
84 |
+ with_test_route_set do |
85 |
+ get '/set_session_value_and_cookie' |
86 |
+ assert_response :success |
87 |
+ assert_equal({"_myapp_session" => response.body, "foo" => "bar"}, cookies) |
88 |
+ end |
89 |
+ end |
90 |
+ |
91 |
private |
92 |
def with_test_route_set |
93 |
with_routing do |set| |
94 |
-- |
95 |
1.7.1 |